diff --git a/evennia/server/portal/portalsessionhandler.py b/evennia/server/portal/portalsessionhandler.py index 746ab40a67..6b465cc0f7 100644 --- a/evennia/server/portal/portalsessionhandler.py +++ b/evennia/server/portal/portalsessionhandler.py @@ -464,6 +464,6 @@ class PortalSessionHandler(SessionHandler): log_trace() -_portal_sessionhandler_class = class_from_module(settings.PORTAL_SESSION_HANDLER_CLASS) +_PORTAL_SESSION_HANDLER_CLASS = class_from_module(settings.PORTAL_SESSION_HANDLER_CLASS) -PORTAL_SESSIONS = _portal_sessionhandler_class() +PORTAL_SESSIONS = _PORTAL_SESSION_HANDLER_CLASS() diff --git a/evennia/server/portal/ssh.py b/evennia/server/portal/ssh.py index 3a47dde433..1fcf296058 100644 --- a/evennia/server/portal/ssh.py +++ b/evennia/server/portal/ssh.py @@ -73,7 +73,7 @@ and put them here: _PRIVATE_KEY_FILE, _PUBLIC_KEY_FILE ) -_BASE_SESSION = class_from_module(settings.BASE_SESSION_CLASS) +_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS) # not used atm @@ -85,7 +85,7 @@ class SSHServerFactory(protocol.ServerFactory): return "SSH" -class SshProtocol(Manhole, _BASE_SESSION): +class SshProtocol(Manhole, _BASE_SESSION_CLASS): """ Each account connecting over ssh gets this protocol assigned to them. All communication between game and account goes through diff --git a/evennia/server/portal/ssl.py b/evennia/server/portal/ssl.py index 03aea685d4..ce58fdf778 100644 --- a/evennia/server/portal/ssl.py +++ b/evennia/server/portal/ssl.py @@ -43,10 +43,10 @@ example (linux, using the openssl program): {exestring} """ -_TELNET_PROTOCOL = class_from_module(settings.TELNET_PROTOCOL_CLASS) +_TELNET_PROTOCOL_CLASS = class_from_module(settings.TELNET_PROTOCOL_CLASS) -class SSLProtocol(_TELNET_PROTOCOL): +class SSLProtocol(_TELNET_PROTOCOL_CLASS): """ Communication is the same as telnet, except data transfer is done with encryption. diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index c45f57d6e0..62ef3d7338 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -55,7 +55,7 @@ _HTTP_WARNING = bytes( ) -_BASE_SESSION = class_from_module(settings.BASE_SESSION_CLASS) +_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS) @@ -67,7 +67,7 @@ class TelnetServerFactory(protocol.ServerFactory): return "Telnet" -class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION): +class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS): """ Each player connecting over telnet (ie using most traditional mud clients) gets a telnet protocol instance assigned to them. All diff --git a/evennia/server/portal/webclient.py b/evennia/server/portal/webclient.py index d56e0a2815..f38e39fabc 100644 --- a/evennia/server/portal/webclient.py +++ b/evennia/server/portal/webclient.py @@ -37,10 +37,10 @@ CLOSE_NORMAL = WebSocketServerProtocol.CLOSE_STATUS_CODE_NORMAL # called when the browser is navigating away from the page GOING_AWAY = WebSocketServerProtocol.CLOSE_STATUS_CODE_GOING_AWAY -_BASE_SESSION = class_from_module(settings.BASE_SESSION_CLASS) +_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS) -class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION): +class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION_CLASS): """ Implements the server-side of the Websocket connection. """ diff --git a/evennia/server/session.py b/evennia/server/session.py index 093472e820..f322c551cf 100644 --- a/evennia/server/session.py +++ b/evennia/server/session.py @@ -35,9 +35,6 @@ class Session(object): """ - # names of attributes that should be affected by syncing. - _attrs_to_sync = settings.SESSION_SYNC_ATTRS - def init_session(self, protocol_key, address, sessionhandler): """ Initialize the Session. This should be called by the protocol when @@ -104,9 +101,7 @@ class Session(object): the keys given by self._attrs_to_sync. """ - return dict( - (key, value) for key, value in self.__dict__.items() if key in self._attrs_to_sync - ) + return {attr: getattr(self, attr, None) for attr in settings.SESSION_SYNC_ATTRS} def load_sync_data(self, sessdata): """ diff --git a/evennia/server/sessionhandler.py b/evennia/server/sessionhandler.py index 23850318f2..b25d25ebb4 100644 --- a/evennia/server/sessionhandler.py +++ b/evennia/server/sessionhandler.py @@ -859,8 +859,8 @@ class ServerSessionHandler(SessionHandler): # import class from settings -_session_handler_class = class_from_module(settings.SERVER_SESSION_HANDLER_CLASS) +_SESSION_HANDLER_CLASS = class_from_module(settings.SERVER_SESSION_HANDLER_CLASS) # Instantiate class. These globals are used to provide singleton-like behavior. -SESSION_HANDLER = _session_handler_class() +SESSION_HANDLER = _SESSION_HANDLER_CLASS() SESSIONS = SESSION_HANDLER # legacy