Strange issue with __init__, proxy implementation not working at the moment.

This commit is contained in:
Griatch 2014-12-19 16:56:28 +01:00
parent 3adeade69a
commit 08d0442f9c
2 changed files with 3 additions and 19 deletions

View file

@ -742,23 +742,6 @@ class PermissionHandler(TagHandler):
# imported for access by other
from src.utils.idmapper.base import SharedMemoryModelBase
class TypeclassModelBase(SharedMemoryModelBase):
"""
Metaclass for typeclasses
"""
def __init__(cls, *args, **kwargs):
"""
We must define our Typeclasses as proxies. We also store the path
directly on the class, this is useful for managers.
"""
super(TypeclassModelBase, cls).__init__(*args, **kwargs)
class Meta:
proxy = True
cls.Meta = Meta
cls.typename = cls.__name__
cls.path = "%s.%s" % (cls.__module__, cls.__name__)
class TypeclassBase(SharedMemoryModelBase):
"""
Metaclass which should be set for the root of model proxies
@ -775,8 +758,8 @@ class TypeclassBase(SharedMemoryModelBase):
proxy = True
cls.Meta = Meta
# convenience for manager methods
cls.typename = cls.__name__
cls.path = "%s.%s" % (cls.__module__, cls.__name__)
#cls.typename = cls.__name__
#cls.path = "%s.%s" % (cls.__module__, cls.__name__)
class TypedObject(SharedMemoryModel):

View file

@ -429,6 +429,7 @@ class SharedMemoryModelBase(ModelBase):
"""
This is for the typeclass system.
"""
super(SharedMemoryModelBase, cls).__init__(*args, **kwargs)
cls.typename = cls.__name__
cls.path = "%s.%s" % (cls.__module__, cls.__name__)