Fix caching error in new cmdset merge regime. Removed debug messages.

This commit is contained in:
Griatch 2016-10-15 23:22:33 +02:00
parent a61a33e87d
commit 1d6873eef4
3 changed files with 2 additions and 12 deletions

View file

@ -273,26 +273,21 @@ def get_and_merge_cmdsets(caller, session, player, obj, callertype):
except AttributeError:
returnValue(((None, None, None), []))
print "callertype:", callertype
local_obj_cmdsets = []
if callertype == "session":
# we are calling the command from the session level
report_to = session
current, cmdsets = yield _get_cmdsets(session)
print "session cmdsets:", len(cmdsets)
if player: # this automatically implies logged-in
pcurrent, player_cmdsets = yield _get_cmdsets(player)
print "player cmdsets:", len(player_cmdsets)
cmdsets += player_cmdsets
current = current + pcurrent
if obj:
ocurrent, obj_cmdsets = yield _get_cmdsets(obj)
print "obj_cmdsets:", len(obj_cmdsets), [cmdset.key for cmdset in obj_cmdsets]
current = current + ocurrent
cmdsets += obj_cmdsets
if not current.no_objs:
local_obj_cmdsets = yield _get_local_obj_cmdsets(obj)
print "local_obj_cmdsets:", len(local_obj_cmdsets), [cmdset.key for cmdset in local_obj_cmdsets]
if current.no_exits:
# filter out all exits
local_obj_cmdsets = [cmdset for cmdset in local_obj_cmdsets if cmdset.key != "ExitCmdSet"]
@ -300,12 +295,9 @@ def get_and_merge_cmdsets(caller, session, player, obj, callertype):
if not current.no_channels:
# also objs may have channels
channel_cmdsets = yield _get_channel_cmdset(obj)
print "obj channel cmdsets:", len(channel_cmdsets), [cmdset.key if cmdset else cmdset for cmdset in channel_cmdsets]
cmdsets += channel_cmdsets
if not current.no_channels:
channel_cmdsets = yield _get_channel_cmdset(player)
print "player channel cmdsets:", len(channel_cmdsets), [cmdset.key for cmdset in channel_cmdsets]
print channel_cmdsets[0].commands
cmdsets += channel_cmdsets
elif callertype == "player":
@ -354,7 +346,6 @@ def get_and_merge_cmdsets(caller, session, player, obj, callertype):
if cmdsets:
# faster to do tuple on list than to build tuple directly
mergehash = tuple([id(cmdset) for cmdset in cmdsets])
print "len(mergehash):", len(mergehash)
if mergehash in _CMDSET_MERGE_CACHE:
# cached merge exist; use that
cmdset = _CMDSET_MERGE_CACHE[mergehash]

View file

@ -68,7 +68,6 @@ class CmdLook(COMMAND_DEFAULT_CLASS):
target = self.caller.search(self.args)
if not target:
return
print "cmdlook:", id(self), id(self.cmdset)
self.msg(self.caller.at_look(target))

View file

@ -1708,14 +1708,14 @@ class DefaultExit(DefaultObject):
"""
if "force_init" in kwargs or not self.cmdset.has_cmdset("_exitset", must_be_default=True):
if "force_init" in kwargs or not self.cmdset.has_cmdset("ExitCmdSet", must_be_default=True):
# we are resetting, or no exit-cmdset was set. Create one dynamically.
self.cmdset.add_default(self.create_exit_cmdset(self), permanent=False)
def at_init(self):
"""
This is called when this objects is re-loaded from cache. When
that happens, we make sure to remove any old _exitset cmdset
that happens, we make sure to remove any old ExitCmdSet cmdset
(this most commonly occurs when renaming an existing exit)
"""
self.cmdset.remove_default()