Changed .typename to properly handle proxy classes.

This commit is contained in:
Griatch 2015-01-02 21:41:29 +01:00
parent 70da53569d
commit 71b6600d87
4 changed files with 4 additions and 3 deletions

View file

@ -232,7 +232,7 @@ from src.commands.default import building
class TestBuilding(CommandTest):
CID = 6
def test_cmds(self):
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new Object: TestObj1.")
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new DefaultObject: TestObj1.")
self.call(building.CmdExamine(), "TestObj1", "Name/key: TestObj1")
self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Alias(es) for 'TestObj1' set to testobj1b.")
self.call(building.CmdCopy(), "TestObj1 = TestObj2;TestObj2b, TestObj3;TestObj3b", "Copied TestObj1 to 'TestObj3' (aliases: ['TestObj3b']")

View file

@ -300,7 +300,7 @@ class ChannelDBManager(TypedObjectManager):
"""
Return all channels a given player is subscribed to
"""
return player.__dbclass__.subscription_set.all()
return player.player.subscription_set.all()
@returns_typeclass_list
def channel_search(self, ostring, exact=True):

View file

@ -94,7 +94,7 @@ class TypeclassBase(SharedMemoryModelBase):
"""
# storage of stats
attrs["typename"] = cls.__name__
attrs["typename"] = name#cls.__name__
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
# typeclass proxy setup

View file

@ -187,6 +187,7 @@ class SharedMemoryModelBase(ModelBase):
for fieldname, field in ((fname, field) for fname, field in attrs.items()
if fname.startswith("db_") and type(field).__name__ != "ManyToManyField"):
foreignkey = type(field).__name__ == "ForeignKey"
#print fieldname, type(field).__name__, field
wrappername = "dbid" if fieldname == "id" else fieldname.replace("db_", "", 1)
#print fieldname, wrappername
if wrappername not in attrs: