Changed .typename to properly handle proxy classes.
This commit is contained in:
parent
70da53569d
commit
71b6600d87
4 changed files with 4 additions and 3 deletions
|
|
@ -232,7 +232,7 @@ from src.commands.default import building
|
||||||
class TestBuilding(CommandTest):
|
class TestBuilding(CommandTest):
|
||||||
CID = 6
|
CID = 6
|
||||||
def test_cmds(self):
|
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.CmdExamine(), "TestObj1", "Name/key: TestObj1")
|
||||||
self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Alias(es) for 'TestObj1' set to testobj1b.")
|
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']")
|
self.call(building.CmdCopy(), "TestObj1 = TestObj2;TestObj2b, TestObj3;TestObj3b", "Copied TestObj1 to 'TestObj3' (aliases: ['TestObj3b']")
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ class ChannelDBManager(TypedObjectManager):
|
||||||
"""
|
"""
|
||||||
Return all channels a given player is subscribed to
|
Return all channels a given player is subscribed to
|
||||||
"""
|
"""
|
||||||
return player.__dbclass__.subscription_set.all()
|
return player.player.subscription_set.all()
|
||||||
|
|
||||||
@returns_typeclass_list
|
@returns_typeclass_list
|
||||||
def channel_search(self, ostring, exact=True):
|
def channel_search(self, ostring, exact=True):
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class TypeclassBase(SharedMemoryModelBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# storage of stats
|
# storage of stats
|
||||||
attrs["typename"] = cls.__name__
|
attrs["typename"] = name#cls.__name__
|
||||||
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
|
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
|
||||||
|
|
||||||
# typeclass proxy setup
|
# typeclass proxy setup
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,7 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
for fieldname, field in ((fname, field) for fname, field in attrs.items()
|
for fieldname, field in ((fname, field) for fname, field in attrs.items()
|
||||||
if fname.startswith("db_") and type(field).__name__ != "ManyToManyField"):
|
if fname.startswith("db_") and type(field).__name__ != "ManyToManyField"):
|
||||||
foreignkey = type(field).__name__ == "ForeignKey"
|
foreignkey = type(field).__name__ == "ForeignKey"
|
||||||
|
#print fieldname, type(field).__name__, field
|
||||||
wrappername = "dbid" if fieldname == "id" else fieldname.replace("db_", "", 1)
|
wrappername = "dbid" if fieldname == "id" else fieldname.replace("db_", "", 1)
|
||||||
#print fieldname, wrappername
|
#print fieldname, wrappername
|
||||||
if wrappername not in attrs:
|
if wrappername not in attrs:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue