Made the proxy typeclass system work in principle, using a wrapper of the __new__ method for the class.

This commit is contained in:
Griatch 2014-12-20 18:30:39 +01:00
parent 8314d8ba5e
commit 32e44dceab
7 changed files with 26 additions and 78 deletions

View file

@ -22,23 +22,11 @@ _MULTISESSION_MODE = settings.MULTISESSION_MODE
_CMDSET_PLAYER = settings.CMDSET_PLAYER
_CONNECT_CHANNEL = None
class Player(PlayerDB):
"""
Base typeclass for all Players.
"""
def __new__(cls, *args, **kwargs):
"""
We must define our Typeclasses as proxies. We also store the path
directly on the class, this is useful for managers.
"""
if hasattr(cls, "Meta"):
cls.Meta.proxy = True
else:
class Meta:
proxy = True
cls.Meta = Meta
return super(Player, cls).__new__(*args, **kwargs)
_is_typeclass = True
def __init__(self):
"""