Ran black on sources, some minor tweaks
This commit is contained in:
parent
5e18dcc562
commit
05f2264eb1
4 changed files with 14 additions and 19 deletions
|
|
@ -115,7 +115,10 @@ def check_warnings(settings):
|
||||||
print(" [Devel: settings.IN_GAME_ERRORS is True. Turn off in production.]")
|
print(" [Devel: settings.IN_GAME_ERRORS is True. Turn off in production.]")
|
||||||
if settings.ALLOWED_HOSTS == ["*"]:
|
if settings.ALLOWED_HOSTS == ["*"]:
|
||||||
print(" [Devel: settings.ALLOWED_HOSTS set to '*' (all). Limit in production.]")
|
print(" [Devel: settings.ALLOWED_HOSTS set to '*' (all). Limit in production.]")
|
||||||
for k,v in settings.DATABASES.items():
|
for dbentry in settings.DATABASES.values():
|
||||||
if "psycopg" in v.get("ENGINE",None):
|
if "psycopg" in dbentry.get("ENGINE", ""):
|
||||||
print(" [Devel: postgresql_psycopg2 backend is deprecated. This module is now called postgresql")
|
print(
|
||||||
print(" Switch settings.DATABASES to use \"ENGINE\": \"django.db.backends.postgresql\"")
|
'Deprecation: postgresql_psycopg2 backend is deprecated". '
|
||||||
|
"Switch settings.DATABASES to use "
|
||||||
|
'"ENGINE": "django.db.backends.postgresql instead"'
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,6 @@ class Portal(object):
|
||||||
self.sessions.disconnect_all()
|
self.sessions.disconnect_all()
|
||||||
if _stop_server:
|
if _stop_server:
|
||||||
self.amp_protocol.stop_server(mode="shutdown")
|
self.amp_protocol.stop_server(mode="shutdown")
|
||||||
|
|
||||||
if not _reactor_stopping:
|
if not _reactor_stopping:
|
||||||
# shutting down the reactor will trigger another signal. We set
|
# shutting down the reactor will trigger another signal. We set
|
||||||
# a flag to avoid loops.
|
# a flag to avoid loops.
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ from django.utils.safestring import SafeString
|
||||||
from evennia.utils.utils import uses_database, is_iter, to_str, to_bytes
|
from evennia.utils.utils import uses_database, is_iter, to_str, to_bytes
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
|
|
||||||
__all__ = ("to_pickle", "from_pickle", "do_pickle",
|
__all__ = ("to_pickle", "from_pickle", "do_pickle", "do_unpickle", "dbserialize", "dbunserialize")
|
||||||
"do_unpickle", "dbserialize", "dbunserialize")
|
|
||||||
|
|
||||||
PICKLE_PROTOCOL = 2
|
PICKLE_PROTOCOL = 2
|
||||||
|
|
||||||
|
|
@ -117,15 +116,13 @@ def _init_globals():
|
||||||
global _FROM_MODEL_MAP, _TO_MODEL_MAP, _SESSION_HANDLER, _IGNORE_DATETIME_MODELS
|
global _FROM_MODEL_MAP, _TO_MODEL_MAP, _SESSION_HANDLER, _IGNORE_DATETIME_MODELS
|
||||||
if not _FROM_MODEL_MAP:
|
if not _FROM_MODEL_MAP:
|
||||||
_FROM_MODEL_MAP = defaultdict(str)
|
_FROM_MODEL_MAP = defaultdict(str)
|
||||||
_FROM_MODEL_MAP.update(dict((c.model, c.natural_key())
|
_FROM_MODEL_MAP.update(dict((c.model, c.natural_key()) for c in ContentType.objects.all()))
|
||||||
for c in ContentType.objects.all()))
|
|
||||||
if not _TO_MODEL_MAP:
|
if not _TO_MODEL_MAP:
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
_TO_MODEL_MAP = defaultdict(str)
|
_TO_MODEL_MAP = defaultdict(str)
|
||||||
_TO_MODEL_MAP.update(
|
_TO_MODEL_MAP.update(
|
||||||
dict((c.natural_key(), c.model_class())
|
dict((c.natural_key(), c.model_class()) for c in ContentType.objects.all())
|
||||||
for c in ContentType.objects.all())
|
|
||||||
)
|
)
|
||||||
_IGNORE_DATETIME_MODELS = []
|
_IGNORE_DATETIME_MODELS = []
|
||||||
for src_key, dst_key in settings.ATTRIBUTE_STORED_MODEL_RENAME:
|
for src_key, dst_key in settings.ATTRIBUTE_STORED_MODEL_RENAME:
|
||||||
|
|
@ -188,8 +185,7 @@ class _SaverMutable(object):
|
||||||
)
|
)
|
||||||
self._db_obj.value = self
|
self._db_obj.value = self
|
||||||
else:
|
else:
|
||||||
logger.log_err(
|
logger.log_err("_SaverMutable %s has no root Attribute to save to." % self)
|
||||||
"_SaverMutable %s has no root Attribute to save to." % self)
|
|
||||||
|
|
||||||
def _convert_mutables(self, data):
|
def _convert_mutables(self, data):
|
||||||
"""converts mutables to Saver* variants and assigns ._parent property"""
|
"""converts mutables to Saver* variants and assigns ._parent property"""
|
||||||
|
|
@ -205,8 +201,7 @@ class _SaverMutable(object):
|
||||||
return dat
|
return dat
|
||||||
elif dtype == dict:
|
elif dtype == dict:
|
||||||
dat = _SaverDict(_parent=parent)
|
dat = _SaverDict(_parent=parent)
|
||||||
dat._data.update((key, process_tree(val, dat))
|
dat._data.update((key, process_tree(val, dat)) for key, val in item.items())
|
||||||
for key, val in item.items())
|
|
||||||
return dat
|
return dat
|
||||||
elif dtype == set:
|
elif dtype == set:
|
||||||
dat = _SaverSet(_parent=parent)
|
dat = _SaverSet(_parent=parent)
|
||||||
|
|
@ -582,8 +577,7 @@ def to_pickle(data):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return item
|
return item
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log_error(
|
logger.log_error(f"The object {item} of type {type(item)} could not be stored.")
|
||||||
f"The object {item} of type {type(item)} could not be stored.")
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
return process_item(data)
|
return process_item(data)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,5 @@ urlpatterns = [
|
||||||
# webclient
|
# webclient
|
||||||
path("webclient/", include("evennia.web.webclient.urls")),
|
path("webclient/", include("evennia.web.webclient.urls")),
|
||||||
# favicon
|
# favicon
|
||||||
path("favicon.ico", RedirectView.as_view(
|
path("favicon.ico", RedirectView.as_view(url="/media/images/favicon.ico", permanent=False)),
|
||||||
url="/media/images/favicon.ico", permanent=False))
|
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue