Made typeclass loading a little more forgiving, adding a multitude of try-levels to fall back to in case of errors. Default is now to fallback to first settings-set default, then to the library default and only as a last resort fall back to the model. Every fallback step is logged. This should make the missing-hook error of #698 go away and report missing typeclasses in a better way.

This commit is contained in:
Griatch 2015-03-11 00:41:06 +01:00
parent c9ed8b5ec5
commit d752106906
5 changed files with 71 additions and 6 deletions

View file

@ -3,6 +3,7 @@ Default Typeclass for Comms.
See objects.objects for more information on Typeclassing.
"""
from django.conf import settings
from evennia.typeclasses.models import TypeclassBase
from evennia.comms.models import Msg, TempMsg, ChannelDB
from evennia.comms.managers import ChannelManager
@ -15,7 +16,10 @@ class DefaultChannel(ChannelDB):
This is the base class for all Comms. Inherit from this to create different
types of communication channels.
"""
# typeclass setup
__metaclass__ = TypeclassBase
__settingclasspath__ = settings.BASE_CHANNEL_TYPECLASS
__defaultclasspath__ = "evennia.comms.comms.DefaultChannel"
objects = ChannelManager()
def at_first_save(self):