Fixed a cyclic import error and a wrong call sign in the oobhandler as per #707.
This commit is contained in:
parent
461545fe58
commit
40421bcc76
2 changed files with 26 additions and 19 deletions
|
|
@ -58,7 +58,7 @@ name.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.utils.utils import to_str
|
from evennia.utils.utils import to_str
|
||||||
from evennia import OOB_HANDLER
|
from evennia.server.oobhandler import OOB_HANDLER
|
||||||
|
|
||||||
_GA = object.__getattribute__
|
_GA = object.__getattribute__
|
||||||
_SA = object.__setattr__
|
_SA = object.__setattr__
|
||||||
|
|
|
||||||
|
|
@ -25,23 +25,9 @@ _SA = object.__setattr__
|
||||||
_GA = object.__getattribute__
|
_GA = object.__getattribute__
|
||||||
_DA = object.__delattr__
|
_DA = object.__delattr__
|
||||||
|
|
||||||
# load resources from plugin module
|
# set at the bottom of this module
|
||||||
_OOB_FUNCS = {}
|
_OOB_FUNCS = None
|
||||||
for modname in make_iter(settings.OOB_PLUGIN_MODULES):
|
_OOB_ERROR = None
|
||||||
_OOB_FUNCS.update(mod_import(modname).CMD_MAP)
|
|
||||||
|
|
||||||
# get the command to receive eventual error strings
|
|
||||||
_OOB_ERROR = _OOB_FUNCS.get("oob_error", None)
|
|
||||||
if not _OOB_ERROR:
|
|
||||||
# no custom error set; create default oob error message function
|
|
||||||
def oob_error(session, errmsg, *args, **kwargs):
|
|
||||||
"""
|
|
||||||
Fallback error handler. This will be used if no custom
|
|
||||||
oob_error is defined and just echoes the error back to the
|
|
||||||
session.
|
|
||||||
"""
|
|
||||||
session.msg(oob=("err", ("ERROR ", errmsg)))
|
|
||||||
_OOB_ERROR = oob_error
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -366,7 +352,7 @@ class OOBHandler(TickerHandler):
|
||||||
sessid = sessid.sessid
|
sessid = sessid.sessid
|
||||||
attrobj = obj.attributes.get(attr_name, return_obj=True)
|
attrobj = obj.attributes.get(attr_name, return_obj=True)
|
||||||
if attrobj:
|
if attrobj:
|
||||||
self._remove_monitor(attrobj, sessid, "db_value", attr_name, oobfuncname)
|
self._remove_monitor(attrobj, sessid, "db_value", oobfuncname)
|
||||||
|
|
||||||
def get_all_monitors(self, sessid):
|
def get_all_monitors(self, sessid):
|
||||||
"""
|
"""
|
||||||
|
|
@ -435,3 +421,24 @@ class OOBHandler(TickerHandler):
|
||||||
|
|
||||||
# access object
|
# access object
|
||||||
OOB_HANDLER = OOBHandler()
|
OOB_HANDLER = OOBHandler()
|
||||||
|
|
||||||
|
# load resources from plugin module. This must happen
|
||||||
|
# AFTER the OOB_HANDLER has been initialized since the
|
||||||
|
# commands will want to import it.
|
||||||
|
_OOB_FUNCS = {}
|
||||||
|
for modname in make_iter(settings.OOB_PLUGIN_MODULES):
|
||||||
|
_OOB_FUNCS.update(mod_import(modname).CMD_MAP)
|
||||||
|
|
||||||
|
# get the command to receive eventual error strings
|
||||||
|
_OOB_ERROR = _OOB_FUNCS.get("oob_error", None)
|
||||||
|
if not _OOB_ERROR:
|
||||||
|
# no custom error set; create default oob error message function
|
||||||
|
def oob_error(session, errmsg, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Fallback error handler. This will be used if no custom
|
||||||
|
oob_error is defined and just echoes the error back to the
|
||||||
|
session.
|
||||||
|
"""
|
||||||
|
session.msg(oob=("err", ("ERROR ", errmsg)))
|
||||||
|
_OOB_ERROR = oob_error
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue