mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 10:16:32 +01:00
Fix error that did not let Session base beoverloaded correctly
This commit is contained in:
parent
fd9b491d09
commit
50779ee84d
4 changed files with 12 additions and 11 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue