From 1a996bbf7e3c31af249f7e1b7a0feec016897b9d Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Tue, 22 May 2007 15:22:25 +0000 Subject: [PATCH] Added a HIDDEN_ATTRIBS list to defines_global.py containing a list of attributes that shouldn't show up on examined objects. --- apps/objects/models.py | 10 +++++----- defines_global.py | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/objects/models.py b/apps/objects/models.py index 065cea9ce5..2312d7b5b9 100755 --- a/apps/objects/models.py +++ b/apps/objects/models.py @@ -1,6 +1,6 @@ from django.db import models from django.contrib.auth.models import User, Group -import defines_global as global_defines +import defines_global import ansi class Attribute(models.Model): @@ -45,7 +45,7 @@ class Object(models.Model): owner = models.ForeignKey('self', related_name="obj_owner", blank=True, null=True) zone = models.ForeignKey('self', related_name="obj_zone", blank=True, null=True) home = models.ForeignKey('self', related_name="obj_home", blank=True, null=True) - type = models.SmallIntegerField(choices=global_defines.OBJECT_TYPES) + type = models.SmallIntegerField(choices=defines_global.OBJECT_TYPES) description = models.TextField(blank=True, null=True) location = models.ForeignKey('self', related_name="obj_location", blank=True, null=True) flags = models.TextField(blank=True, null=True) @@ -301,7 +301,7 @@ class Object(models.Model): """ Returns a QuerySet of an object's attributes. """ - return self.attribute_set.all() + return [attr for attr in self.attribute_set.all() if attr.name.upper() not in defines_global.HIDDEN_ATTRIBS] def clear_all_attributes(self): """ @@ -619,7 +619,7 @@ class Object(models.Model): if return_number: return self.type else: - return global_defines.OBJECT_TYPES[self.type][1] + return defines_global.OBJECT_TYPES[self.type][1] def is_type(self, otype): """ @@ -648,7 +648,7 @@ class Object(models.Model): # We have to cast this because the admin interface is really picky # about tuple index types. Bleh. otype = int(self.type) - return global_defines.OBJECT_TYPES[otype][1][0] + return defines_global.OBJECT_TYPES[otype][1][0] class CommChannel(models.Model): """ diff --git a/defines_global.py b/defines_global.py index 59b87f71d7..054935079d 100755 --- a/defines_global.py +++ b/defines_global.py @@ -32,6 +32,9 @@ NOSET_FLAGS = ["CONNECTED"] # These attribute names can't be modified by players. NOSET_ATTRIBS = ["MONEY", "ALIAS", "LASTPAGED", "CHANLIST", "LAST", "LASTSITE"] +# These attributes don't show up on objects when examined. +HIDDEN_ATTRIBS = ["CHANLIST"] + # Server version number. EVENNIA_VERSION = 'Alpha'