diff --git a/src/commands/default/tests.py b/src/commands/default/tests.py index fc28bad6c7..5b3d27d58b 100644 --- a/src/commands/default/tests.py +++ b/src/commands/default/tests.py @@ -143,8 +143,12 @@ class TestPassword(CommandTest): self.execute_cmd("@password testpassword = newpassword") class TestNick(CommandTest): def test_call(self): - self.execute_cmd("nickname testalias = testaliasedstring") - self.assertEquals("testaliasedstring", self.char1.nicks.get("testalias", None)) + self.execute_cmd("nickname testalias = testaliasedstring1") + self.execute_cmd("nickname/player testalias = testaliasedstring2") + self.execute_cmd("nickname/object testalias = testaliasedstring3") + self.assertEquals(u"testaliasedstring1", self.char1.nickhandler("testalias")) + self.assertEquals(u"testaliasedstring2", self.char1.nickhandler("testalias",nick_type="player")) + self.assertEquals(u"testaliasedstring3", self.char1.nickhandler("testalias",nick_type="object")) # system.py command tests class TestPy(CommandTest): diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index dc9831ffe0..0b15dbba4f 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -269,11 +269,11 @@ class Attribute(SharedMemoryModel): def _convert_value(self, in_value): """ - We have to be careful as to what we store. Some things, - such as dhango model instances, cannot be directly stored/pickled - in an attribute, so we have to be clever about it. - Types of objects and how they are handled: - * str - s5Atored directly in field + We have to be careful as to what we store. Some things, such + as django model instances, cannot be directly stored/pickled + in an attribute, so we have to be clever about it. Types of + objects and how they are handled: + * str - stored directly in field * django model object - store its dbref in field * any other python structure - pickle in field @@ -294,6 +294,13 @@ class Attribute(SharedMemoryModel): # strings we just store directly. return in_value, None + if is_iter(in_value): + # an iterable. This is normally something to pickle, + # but we have to be careful so as to not find + # django model instances nested in the iterable. + pass #TODO! + + if not has_parent('django.db.models.base.Model', in_value) \ and not has_parent(PARENTS['typeclass'], in_value): # non-django models that are not strings we pickle