Made Evennia run with Django 1.9
This commit is contained in:
parent
ba1f10e88f
commit
e6a866a150
7 changed files with 11 additions and 32 deletions
|
|
@ -3,5 +3,3 @@ This sub-package defines the basic in-game "Object". All in-game
|
||||||
objects inherit from classes in this package.
|
objects inherit from classes in this package.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
|
||||||
from .objects import DefaultObject, DefaultRoom, DefaultExit, DefaultCharacter
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,3 @@ Players. These are equivalent to 'accounts' and can puppet one or
|
||||||
more Objects depending on settings. A Player has no in-game existence.
|
more Objects depending on settings. A Player has no in-game existence.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
|
||||||
from .players import DefaultGuest, DefaultPlayer
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,3 @@ or globally. They may also have a timer-component to execute various
|
||||||
timed effects.
|
timed effects.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
|
||||||
from .scripts import DefaultScript
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ from django.apps import apps
|
||||||
from django.db.models.base import ModelBase, subclass_exception
|
from django.db.models.base import ModelBase, subclass_exception
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db.models.options import Options
|
from django.db.models.options import Options
|
||||||
from django.utils.deprecation import RemovedInDjango19Warning
|
|
||||||
from django.core.exceptions import MultipleObjectsReturned, FieldError
|
from django.core.exceptions import MultipleObjectsReturned, FieldError
|
||||||
from django.apps.config import MODELS_MODULE_NAME
|
from django.apps.config import MODELS_MODULE_NAME
|
||||||
from django.db.models.fields.related import OneToOneField
|
from django.db.models.fields.related import OneToOneField
|
||||||
|
|
@ -61,29 +60,15 @@ def patched_new(cls, name, bases, attrs):
|
||||||
# For 'django.contrib.sites.models', this would be 'sites'.
|
# For 'django.contrib.sites.models', this would be 'sites'.
|
||||||
# For 'geo.models.places' this would be 'geo'.
|
# For 'geo.models.places' this would be 'geo'.
|
||||||
|
|
||||||
|
if abstract:
|
||||||
|
kwargs = {"app_label": None}
|
||||||
|
else:
|
||||||
msg = (
|
msg = (
|
||||||
"Model class %s.%s doesn't declare an explicit app_label "
|
"Model class %s.%s doesn't declare an explicit app_label "
|
||||||
"and either isn't in an application in INSTALLED_APPS or "
|
"and either isn't in an application in INSTALLED_APPS or "
|
||||||
"else was imported before its application was loaded. " %
|
"else was imported before its application was loaded. " %
|
||||||
(module, name))
|
(module, name))
|
||||||
if abstract:
|
raise RuntimeError(msg)
|
||||||
msg += "Its app_label will be set to None in Django 1.9."
|
|
||||||
else:
|
|
||||||
msg += "This will no longer be supported in Django 1.9."
|
|
||||||
warnings.warn(msg, RemovedInDjango19Warning, stacklevel=2)
|
|
||||||
|
|
||||||
model_module = sys.modules[new_class.__module__]
|
|
||||||
package_components = model_module.__name__.split('.')
|
|
||||||
package_components.reverse() # find the last occurrence of 'models'
|
|
||||||
try:
|
|
||||||
app_label_index = package_components.index(MODELS_MODULE_NAME) + 1
|
|
||||||
except ValueError:
|
|
||||||
app_label_index = 1
|
|
||||||
kwargs = {"app_label": package_components[app_label_index]}
|
|
||||||
|
|
||||||
else:
|
|
||||||
kwargs = {"app_label": app_config.label}
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from twisted.internet.reactor import callFromThread
|
||||||
from django.core.exceptions import ObjectDoesNotExist, FieldError
|
from django.core.exceptions import ObjectDoesNotExist, FieldError
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
from django.db.models.base import Model, ModelBase
|
from django.db.models.base import Model, ModelBase
|
||||||
from django.db.models.signals import pre_delete, post_syncdb
|
from django.db.models.signals import pre_delete, post_migrate
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
from evennia.utils.utils import dbref, get_evennia_pids, to_str
|
from evennia.utils.utils import dbref, get_evennia_pids, to_str
|
||||||
|
|
||||||
|
|
@ -446,7 +446,7 @@ def flush_cache(**kwargs):
|
||||||
# run the python garbage collector
|
# run the python garbage collector
|
||||||
return gc.collect()
|
return gc.collect()
|
||||||
#request_finished.connect(flush_cache)
|
#request_finished.connect(flush_cache)
|
||||||
post_syncdb.connect(flush_cache)
|
post_migrate.connect(flush_cache)
|
||||||
|
|
||||||
|
|
||||||
def flush_cached_instance(sender, instance, **kwargs):
|
def flush_cached_instance(sender, instance, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ from django.db import models
|
||||||
|
|
||||||
# django 1.5 introduces force_text instead of force_unicode
|
# django 1.5 introduces force_text instead of force_unicode
|
||||||
from django.forms import CharField, Textarea
|
from django.forms import CharField, Textarea
|
||||||
from django.forms.util import flatatt
|
from django.forms.utils import flatatt
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
|
|
||||||
from evennia.utils.dbserialize import from_pickle, to_pickle
|
from evennia.utils.dbserialize import from_pickle, to_pickle
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Evennia dependencies, for Linux/Mac platforms
|
# Evennia dependencies, for Linux/Mac platforms
|
||||||
|
|
||||||
django >= 1.8, < 1.9
|
django >= 1.8, < 2.0
|
||||||
twisted >= 15.2.1
|
twisted >= 15.2.1
|
||||||
mock >= 1.0.1
|
mock >= 1.0.1
|
||||||
pillow == 2.9.0
|
pillow == 2.9.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue