Ran black on sources, some minor tweaks

This commit is contained in:
Griatch 2020-02-12 23:07:56 +01:00
parent 555dc92dce
commit 4eb631af74
4 changed files with 14 additions and 19 deletions

View file

@ -115,7 +115,10 @@ def check_warnings(settings):
print(" [Devel: settings.IN_GAME_ERRORS is True. Turn off in production.]")
if settings.ALLOWED_HOSTS == ["*"]:
print(" [Devel: settings.ALLOWED_HOSTS set to '*' (all). Limit in production.]")
for k,v in settings.DATABASES.items():
if "psycopg" in v.get("ENGINE",None):
print(" [Devel: postgresql_psycopg2 backend is deprecated. This module is now called postgresql")
print(" Switch settings.DATABASES to use \"ENGINE\": \"django.db.backends.postgresql\"")
for dbentry in settings.DATABASES.values():
if "psycopg" in dbentry.get("ENGINE", ""):
print(
'Deprecation: postgresql_psycopg2 backend is deprecated". '
"Switch settings.DATABASES to use "
'"ENGINE": "django.db.backends.postgresql instead"'
)

View file

@ -190,7 +190,6 @@ class Portal(object):
self.sessions.disconnect_all()
if _stop_server:
self.amp_protocol.stop_server(mode="shutdown")
if not _reactor_stopping:
# shutting down the reactor will trigger another signal. We set
# a flag to avoid loops.

View file

@ -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 import logger
__all__ = ("to_pickle", "from_pickle", "do_pickle",
"do_unpickle", "dbserialize", "dbunserialize")
__all__ = ("to_pickle", "from_pickle", "do_pickle", "do_unpickle", "dbserialize", "dbunserialize")
PICKLE_PROTOCOL = 2
@ -117,15 +116,13 @@ def _init_globals():
global _FROM_MODEL_MAP, _TO_MODEL_MAP, _SESSION_HANDLER, _IGNORE_DATETIME_MODELS
if not _FROM_MODEL_MAP:
_FROM_MODEL_MAP = defaultdict(str)
_FROM_MODEL_MAP.update(dict((c.model, c.natural_key())
for c in ContentType.objects.all()))
_FROM_MODEL_MAP.update(dict((c.model, c.natural_key()) for c in ContentType.objects.all()))
if not _TO_MODEL_MAP:
from django.conf import settings
_TO_MODEL_MAP = defaultdict(str)
_TO_MODEL_MAP.update(
dict((c.natural_key(), c.model_class())
for c in ContentType.objects.all())
dict((c.natural_key(), c.model_class()) for c in ContentType.objects.all())
)
_IGNORE_DATETIME_MODELS = []
for src_key, dst_key in settings.ATTRIBUTE_STORED_MODEL_RENAME:
@ -188,8 +185,7 @@ class _SaverMutable(object):
)
self._db_obj.value = self
else:
logger.log_err(
"_SaverMutable %s has no root Attribute to save to." % self)
logger.log_err("_SaverMutable %s has no root Attribute to save to." % self)
def _convert_mutables(self, data):
"""converts mutables to Saver* variants and assigns ._parent property"""
@ -205,8 +201,7 @@ class _SaverMutable(object):
return dat
elif dtype == dict:
dat = _SaverDict(_parent=parent)
dat._data.update((key, process_tree(val, dat))
for key, val in item.items())
dat._data.update((key, process_tree(val, dat)) for key, val in item.items())
return dat
elif dtype == set:
dat = _SaverSet(_parent=parent)
@ -582,8 +577,7 @@ def to_pickle(data):
except TypeError:
return item
except Exception:
logger.log_error(
f"The object {item} of type {type(item)} could not be stored.")
logger.log_error(f"The object {item} of type {type(item)} could not be stored.")
raise
return process_item(data)

View file

@ -18,6 +18,5 @@ urlpatterns = [
# webclient
path("webclient/", include("evennia.web.webclient.urls")),
# favicon
path("favicon.ico", RedirectView.as_view(
url="/media/images/favicon.ico", permanent=False))
path("favicon.ico", RedirectView.as_view(url="/media/images/favicon.ico", permanent=False)),
]