Better solution - can call __init__ manually with typeclass as a kwarg, and this seems to resolve it

This commit is contained in:
Tehom 2016-12-05 06:58:05 -05:00
parent 5e7211a053
commit 560def1f2b

View file

@ -147,13 +147,8 @@ class ObjectDBAdmin(admin.ModelAdmin):
obj.save()
if not change:
# adding a new object
# no idea why this has to be called manually, __init__ does not seem to be called
from evennia.utils.utils import class_from_module
try:
typeclass = class_from_module(obj.db_typeclass_path)
except ImportError:
typeclass = class_from_module("evennia.objects.objects.DefaultObject")
obj.__class__ = typeclass
# have to call init with typeclass passed to it
obj.__init__(typeclass=obj.db_typeclass_path)
obj.basetype_setup()
obj.basetype_posthook_setup()
obj.at_object_creation()