Updates for making Evennia compatible with Django 1.8+. Still not fully functioning.
This commit is contained in:
parent
1bb886de03
commit
ee1ec3979c
7 changed files with 8 additions and 17 deletions
|
|
@ -471,6 +471,7 @@ class ChannelDB(TypedObject):
|
||||||
|
|
||||||
__settingclasspath__ = settings.BASE_CHANNEL_TYPECLASS
|
__settingclasspath__ = settings.BASE_CHANNEL_TYPECLASS
|
||||||
__defaultclasspath__ = "evennia.comms.comms.DefaultChannel"
|
__defaultclasspath__ = "evennia.comms.comms.DefaultChannel"
|
||||||
|
__applabel__ = "comms"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"Define Django meta options"
|
"Define Django meta options"
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ class ObjectDB(TypedObject):
|
||||||
# defaults
|
# defaults
|
||||||
__settingsclasspath__ = settings.BASE_OBJECT_TYPECLASS
|
__settingsclasspath__ = settings.BASE_OBJECT_TYPECLASS
|
||||||
__defaultclasspath__ = "evennia.objects.objects.DefaultObject"
|
__defaultclasspath__ = "evennia.objects.objects.DefaultObject"
|
||||||
|
__applabel__ = "objects"
|
||||||
|
|
||||||
@lazy_property
|
@lazy_property
|
||||||
def contents_cache(self):
|
def contents_cache(self):
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,9 @@ class PlayerDB(TypedObject, AbstractUser):
|
||||||
# defaults
|
# defaults
|
||||||
__settingsclasspath__ = settings.BASE_SCRIPT_TYPECLASS
|
__settingsclasspath__ = settings.BASE_SCRIPT_TYPECLASS
|
||||||
__defaultclasspath__ = "evennia.players.players.DefaultPlayer"
|
__defaultclasspath__ = "evennia.players.players.DefaultPlayer"
|
||||||
|
__applabel__ = "players"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
app_label = 'players'
|
|
||||||
verbose_name = 'Player'
|
verbose_name = 'Player'
|
||||||
|
|
||||||
# alias to the objs property
|
# alias to the objs property
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class ScriptDBManager(TypedObjectManager):
|
||||||
"""
|
"""
|
||||||
if not obj:
|
if not obj:
|
||||||
return []
|
return []
|
||||||
player = _GA(_GA(obj, "__class__"), "__name__") == "PlayerDB"
|
player = _GA(_GA(obj, "__dbclass__"), "__name__") == "PlayerDB"
|
||||||
if key:
|
if key:
|
||||||
dbref = self.dbref(key)
|
dbref = self.dbref(key)
|
||||||
if dbref or dbref == 0:
|
if dbref or dbref == 0:
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ class ScriptDB(TypedObject):
|
||||||
# defaults
|
# defaults
|
||||||
__settingsclasspath__ = settings.BASE_SCRIPT_TYPECLASS
|
__settingsclasspath__ = settings.BASE_SCRIPT_TYPECLASS
|
||||||
__defaultclasspath__ = "evennia.scripts.scripts.DefaultScript"
|
__defaultclasspath__ = "evennia.scripts.scripts.DefaultScript"
|
||||||
|
__applabel__ = "scripts"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"Define Django meta options"
|
"Define Django meta options"
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,8 @@ def check_database():
|
||||||
# Check so a database exists and is accessible
|
# Check so a database exists and is accessible
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
tables = connection.introspection.get_table_list(connection.cursor())
|
tables = connection.introspection.get_table_list(connection.cursor())
|
||||||
|
if not isinstance(tables, basestring): # django 1.8+
|
||||||
|
tables = [tableinfo.name for tableinfo in tables]
|
||||||
if tables and u'players_playerdb' in tables:
|
if tables and u'players_playerdb' in tables:
|
||||||
# database exists and seems set up. Initialize evennia.
|
# database exists and seems set up. Initialize evennia.
|
||||||
import evennia
|
import evennia
|
||||||
|
|
|
||||||
|
|
@ -91,26 +91,12 @@ class TypeclassBase(SharedMemoryModelBase):
|
||||||
# storage of stats
|
# storage of stats
|
||||||
attrs["typename"] = name
|
attrs["typename"] = name
|
||||||
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
|
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
|
||||||
#defaultpath = attrs["__defaultclasspath__"]
|
|
||||||
#attrs["__defaultclass__"] = class_from_module(attrs["__defaultclasspath__"])
|
|
||||||
#try:
|
|
||||||
# defaultpath = attrs["__defaultclasspath__"]
|
|
||||||
# attrs["__defaultclass__"] = class_from_module(attrs["__defaultclasspath__"])
|
|
||||||
#except Exception:
|
|
||||||
# log_trace("Typeclass error for %s: Default typeclass '%s' could not load. "
|
|
||||||
# "Falling back to library base." % (name, defaultpath))
|
|
||||||
# try:
|
|
||||||
# # two levels down from TypedObject will always be the default base class.
|
|
||||||
# attrs["__defaultclass__"] = cls.__mro__[cls.__mro__.index(TypedObject)-2]
|
|
||||||
# except Exception:
|
|
||||||
# log_trace("Critical error for %s: Neither typeclass, "
|
|
||||||
# "default fallback nor base class could load." % name)
|
|
||||||
# attrs["__defaultclass__"] = cls
|
|
||||||
|
|
||||||
# typeclass proxy setup
|
# typeclass proxy setup
|
||||||
if not "Meta" in attrs:
|
if not "Meta" in attrs:
|
||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
app_label = attrs.get("__applabel__", "typeclasses")
|
||||||
attrs["Meta"] = Meta
|
attrs["Meta"] = Meta
|
||||||
attrs["Meta"].proxy = True
|
attrs["Meta"].proxy = True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue