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:
Griatch 2015-03-06 19:51:51 +01:00
parent 000f14c028
commit 84ccbf6b86
3 changed files with 16 additions and 7 deletions

View file

@ -19,4 +19,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(remove_manage_scripts),
]

View file

@ -15,8 +15,8 @@ from evennia.scripts.manager import ScriptManager
from evennia.comms import channelhandler
from evennia.utils import logger
__all__ = ["DefaultScript", "DoNothing", "CheckSessions",
"ValidateScripts", "ValidateChannelHandler"]
__all__ = ["DefaultScript", "DoNothing", "Store"]
_GA = object.__getattribute__
_SESSIONS = None

View file

@ -41,8 +41,9 @@ from evennia.utils.idmapper.models import SharedMemoryModel, SharedMemoryModelBa
from evennia.typeclasses import managers
from evennia.locks.lockhandler import LockHandler
from evennia.utils.utils import (
is_iter, inherits_from, lazy_property,
class_from_module)
is_iter, inherits_from, lazy_property,
class_from_module)
from evennia.utils.logger import log_trace
from evennia.typeclasses.django_new_patch import patched_new
__all__ = ("TypedObject", )
@ -180,10 +181,17 @@ class TypedObject(SharedMemoryModel):
typeclass_path = kwargs.pop("typeclass", None)
super(TypedObject, self).__init__(*args, **kwargs)
if typeclass_path:
self.__class__ = class_from_module(typeclass_path)
self.db_typclass_path = typeclass_path
try:
self.__class__ = class_from_module(typeclass_path)
except ImportError:
log_trace()
finally:
self.db_typclass_path = 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:
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__