Fixed creation. Time to start cleaning the .dbobj hierarchy.

This commit is contained in:
Griatch 2014-12-20 19:29:38 +01:00
parent e28d544fb0
commit 4e0b5be962
5 changed files with 13 additions and 8 deletions

View file

@ -41,7 +41,7 @@ class Object(ObjectDB):
__metaclass__ = TypeclassBase __metaclass__ = TypeclassBase
# __init__ is only defined here in order to present docstring to API. # __init__ is only defined here in order to present docstring to API.
def __init__(self): def __init__(self, *args, **kwargs):
""" """
This is the root typeclass object, representing all entities This is the root typeclass object, representing all entities
that have an actual presence in-game. Objects generally have a that have an actual presence in-game. Objects generally have a
@ -192,7 +192,7 @@ class Object(ObjectDB):
this object speaks this object speaks
""" """
super(Object, self).__init__() super(Object, self).__init__(*args, **kwargs)
## methods inherited from the database object (overload them here) ## methods inherited from the database object (overload them here)

View file

@ -29,7 +29,7 @@ class Player(PlayerDB):
""" """
__metaclass__ = TypeclassBase __metaclass__ = TypeclassBase
def __init__(self): def __init__(self, *args, **kwargs):
""" """
This is the base Typeclass for all Players. Players represent This is the base Typeclass for all Players. Players represent
the person playing the game and tracks account info, password the person playing the game and tracks account info, password
@ -103,7 +103,7 @@ class Player(PlayerDB):
at_server_shutdown() at_server_shutdown()
""" """
super(Player, self).__init__() super(Player, self).__init__(*args, **kwargs)
## methods inherited from database model ## methods inherited from database model

View file

@ -354,7 +354,7 @@ class Script(ScriptBase):
the hooks called by the script machinery. the hooks called by the script machinery.
""" """
def __init__(self): def __init__(self, *args, **kwargs):
""" """
This is the base TypeClass for all Scripts. Scripts describe events, This is the base TypeClass for all Scripts. Scripts describe events,
timers and states in game, they can have a time component or describe timers and states in game, they can have a time component or describe
@ -441,7 +441,7 @@ class Script(ScriptBase):
""" """
super(Script, self).__init__() super(Script, self).__init__(*args, **kwargs)
def at_script_creation(self): def at_script_creation(self):
""" """

View file

@ -764,11 +764,16 @@ class TypeclassBase(SharedMemoryModelBase):
Metaclass which should be set for the root of model proxies Metaclass which should be set for the root of model proxies
that don't define any new fields, like Object, Script etc. that don't define any new fields, like Object, Script etc.
""" """
def __new__(cls, name, bases, attrs): def __new__(cls, name, bases, attrs):
""" """
We must define our Typeclasses as proxies. We also store the path We must define our Typeclasses as proxies. We also store the path
directly on the class, this is useful for managers. directly on the class, this is useful for managers.
""" """
attrs["typename"] = cls.__name__
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
# typeclass proxy setup # typeclass proxy setup
if "Meta" in attrs: if "Meta" in attrs:
attrs["Meta"].proxy = True attrs["Meta"].proxy = True

View file

@ -82,8 +82,8 @@ class SharedMemoryModelBase(ModelBase):
document this auto-wrapping in the class header, this could seem very much like magic to the user otherwise. document this auto-wrapping in the class header, this could seem very much like magic to the user otherwise.
""" """
attrs["typename"] = cls.__name__ #attrs["typename"] = cls.__name__
attrs["path"] = "%s.%s" % (attrs["__module__"], name) #attrs["path"] = "%s.%s" % (attrs["__module__"], name)
# set up the typeclass handling only if a variable _is_typeclass is set on the class # set up the typeclass handling only if a variable _is_typeclass is set on the class
def create_wrapper(cls, fieldname, wrappername, editable=True, foreignkey=False): def create_wrapper(cls, fieldname, wrappername, editable=True, foreignkey=False):