Fixed a migration that didn't run properly. Made typeclass loading a little more forgiving, giving a log_trace and loading the dbclass rather than crashing immediately.
This commit is contained in:
parent
000f14c028
commit
84ccbf6b86
3 changed files with 16 additions and 7 deletions
|
|
@ -19,4 +19,5 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.RunPython(remove_manage_scripts),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ from evennia.scripts.manager import ScriptManager
|
||||||
from evennia.comms import channelhandler
|
from evennia.comms import channelhandler
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
|
|
||||||
__all__ = ["DefaultScript", "DoNothing", "CheckSessions",
|
__all__ = ["DefaultScript", "DoNothing", "Store"]
|
||||||
"ValidateScripts", "ValidateChannelHandler"]
|
|
||||||
|
|
||||||
_GA = object.__getattribute__
|
_GA = object.__getattribute__
|
||||||
_SESSIONS = None
|
_SESSIONS = None
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ from evennia.utils.idmapper.models import SharedMemoryModel, SharedMemoryModelBa
|
||||||
from evennia.typeclasses import managers
|
from evennia.typeclasses import managers
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.utils.utils import (
|
from evennia.utils.utils import (
|
||||||
is_iter, inherits_from, lazy_property,
|
is_iter, inherits_from, lazy_property,
|
||||||
class_from_module)
|
class_from_module)
|
||||||
|
from evennia.utils.logger import log_trace
|
||||||
from evennia.typeclasses.django_new_patch import patched_new
|
from evennia.typeclasses.django_new_patch import patched_new
|
||||||
|
|
||||||
__all__ = ("TypedObject", )
|
__all__ = ("TypedObject", )
|
||||||
|
|
@ -180,10 +181,17 @@ class TypedObject(SharedMemoryModel):
|
||||||
typeclass_path = kwargs.pop("typeclass", None)
|
typeclass_path = kwargs.pop("typeclass", None)
|
||||||
super(TypedObject, self).__init__(*args, **kwargs)
|
super(TypedObject, self).__init__(*args, **kwargs)
|
||||||
if typeclass_path:
|
if typeclass_path:
|
||||||
self.__class__ = class_from_module(typeclass_path)
|
try:
|
||||||
self.db_typclass_path = typeclass_path
|
self.__class__ = class_from_module(typeclass_path)
|
||||||
|
except ImportError:
|
||||||
|
log_trace()
|
||||||
|
finally:
|
||||||
|
self.db_typclass_path = typeclass_path
|
||||||
elif self.db_typeclass_path:
|
elif self.db_typeclass_path:
|
||||||
self.__class__ = class_from_module(self.db_typeclass_path)
|
try:
|
||||||
|
self.__class__ = class_from_module(self.db_typeclass_path)
|
||||||
|
except ImportError:
|
||||||
|
log_trace()
|
||||||
else:
|
else:
|
||||||
self.db_typeclass_path = "%s.%s" % (self.__module__, self.__class__.__name__)
|
self.db_typeclass_path = "%s.%s" % (self.__module__, self.__class__.__name__)
|
||||||
# important to put this at the end since _meta is based on the set __class__
|
# important to put this at the end since _meta is based on the set __class__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue