Fix error that did not let Session base beoverloaded correctly

This commit is contained in:
Griatch 2020-11-24 18:38:43 +01:00
parent fd9b491d09
commit 50779ee84d
4 changed files with 12 additions and 11 deletions

View file

@ -11,7 +11,7 @@ from django.utils import timezone
from django.conf import settings
from evennia.comms.models import ChannelDB
from evennia.utils import logger
from evennia.utils.utils import make_iter, lazy_property
from evennia.utils.utils import make_iter, lazy_property, class_from_module
from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.server.session import Session
from evennia.scripts.monitorhandler import MONITOR_HANDLER
@ -25,13 +25,15 @@ _ANSI = None
# i18n
from django.utils.translation import gettext as _
_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS)
# -------------------------------------------------------------
# Server Session
# -------------------------------------------------------------
class ServerSession(Session):
class ServerSession(_BASE_SESSION_CLASS):
"""
This class represents an account's session and is a template for
individual protocols to communicate with Evennia.

View file

@ -12,7 +12,7 @@ import time
# ------------------------------------------------------------
class Session(object):
class Session:
"""
This class represents a player's session and is a template for
both portal- and server-side sessions.

View file

@ -18,7 +18,7 @@ from django.conf import settings
from evennia.commands.cmdhandler import CMD_LOGINSTART
from evennia.utils.logger import log_trace
from evennia.utils.utils import (
variable_from_module,
variable_from_module, class_from_module,
is_iter,
make_iter,
delay,
@ -75,8 +75,7 @@ def delayed_import():
global _ServerSession, _AccountDB, _ServerConfig, _ScriptDB
if not _ServerSession:
# we allow optional arbitrary serversession class for overloading
modulename, classname = settings.SERVER_SESSION_CLASS.rsplit(".", 1)
_ServerSession = variable_from_module(modulename, classname)
_ServerSession = class_from_module(settings.SERVER_SESSION_CLASS)
if not _AccountDB:
from evennia.accounts.models import AccountDB as _AccountDB
if not _ServerConfig:
@ -84,10 +83,10 @@ def delayed_import():
if not _ScriptDB:
from evennia.scripts.models import ScriptDB as _ScriptDB
# including once to avoid warnings in Python syntax checkers
assert _ServerSession
assert _AccountDB
assert _ServerConfig
assert _ScriptDB
assert _ServerSession, "ServerSession class could not load"
assert _AccountDB, "AccountDB class could not load"
assert _ServerConfig, "ServerConfig class could not load"
assert _ScriptDB, "ScriptDB class c ould not load"
# -----------------------------------------------------------

View file

@ -1411,7 +1411,7 @@ def fuzzy_import_from_module(path, variable, default=None, defaultpaths=None):
def class_from_module(path, defaultpaths=None):
"""
Return a class from a module, given the module's path. This is
Return a class from a module, given the class' full python path. This is
primarily used to convert db_typeclass_path:s to classes.
Args: