Various fixes and debugging of weak-ref changes

This commit is contained in:
Griatch 2014-05-10 19:38:23 +02:00
parent 0030530021
commit 63c099c22f
6 changed files with 24 additions and 81 deletions

View file

@ -262,6 +262,7 @@ def at_multimatch_cmd(caller, matches):
id1 = ""
id2 = ""
print "cmd.obj:", cmd, cmd.obj
if (not (is_channel or is_exit) and
(hasattr(cmd, 'obj') and cmd.obj != caller) and
hasattr(cmd.obj, "key")):

View file

@ -137,7 +137,7 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False):
if not no_logging:
logger.log_trace(errstring)
if emit_to_obj and not ServerConfig.objects.conf("server_starting_mode"):
object.__getattribute__(emit_to_obj, "msg")(errstring)
emit_to_obj.msg(errstring)
err_cmdset = _ErrorCmdSet()
err_cmdset.errmessage = errstring
return err_cmdset
@ -254,7 +254,7 @@ class CmdSetHandler(object):
elif path:
cmdset = self._import_cmdset(path)
if cmdset:
cmdset.permanent = cmdset.key != '_ERROR_CMDSET'
cmdset.permanent = cmdset.key != '_CMDSET_ERROR'
self.cmdset_stack.append(cmdset)
# merge the stack into a new merged cmdset
@ -290,9 +290,9 @@ class CmdSetHandler(object):
handler. Not sure when this would be useful, but it's a 'quirk'
that has to be documented.
"""
if not (isinstance(cmdset, basestring) or utils.inherits_from(cmdset, CmdSet)):
raise Exception(_("Only CmdSets can be added to the cmdsethandler!"))
if callable(cmdset):
if not utils.inherits_from(cmdset, CmdSet):
raise Exception(_("Only CmdSets can be added to the cmdsethandler!"))
cmdset = cmdset(self.obj)
elif isinstance(cmdset, basestring):
# this is (maybe) a python path. Try to import from cache.

View file

@ -200,11 +200,10 @@ class CmdPy(MuxCommand):
errlist = errlist[4:]
ret = "\n".join("{n<<< %s" % line for line in errlist if line)
if ret is not None:
try:
self.msg(ret, sessid=self.sessid)
except TypeError:
self.msg(ret)
try:
self.msg(ret, sessid=self.sessid)
except TypeError:
self.msg(ret)
# helper function. Kept outside so it can be imported and run