From 306ce170229955eaa514abf113848bfd3764ce36 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 5 Aug 2014 09:16:00 +0200 Subject: [PATCH] Fixed some lingering uses of sessid as a non-handler. --- src/commands/default/building.py | 12 ++++++------ src/server/sessionhandler.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 4b176c3b73..db24abf7e6 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1649,8 +1649,8 @@ class CmdExamine(ObjManipCommand): string = "\n{wName/key{n: {c%s{n (%s)" % (obj.name, obj.dbref) if hasattr(obj, "aliases") and obj.aliases.all(): string += "\n{wAliases{n: %s" % (", ".join(utils.make_iter(str(obj.aliases)))) - if hasattr(obj, "sessid") and obj.sessid: - string += "\n{wsession{n: %s" % obj.sessid + if hasattr(obj, "sessid") and obj.sessid.count(): + string += "\n{wsession{n: %s" % obj.sessid.get() elif hasattr(obj, "sessions") and obj.sessions: string += "\n{wsession(s){n: %s" % (", ".join(str(sess.sessid) for sess in obj.sessions)) @@ -1709,12 +1709,12 @@ class CmdExamine(ObjManipCommand): # if we merge on the object level. if hasattr(obj, "player") and obj.player: all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.cmdset.all()]) - if obj.sessid: - all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.get_session(obj.sessid).cmdset.all()]) + if obj.sessid.count(): + all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.get_session(obj.sessid.get()).cmdset.all()]) else: try: # we have to protect this since many objects don't have sessions. - all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.get_session(obj.sessid).cmdset.all()]) + all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.get_session(obj.sessid.get()).cmdset.all()]) except (TypeError, AttributeError): pass all_cmdsets = [cmdset for cmdset in dict(all_cmdsets).values()] @@ -1818,7 +1818,7 @@ class CmdExamine(ObjManipCommand): # we are only interested in specific attributes caller.msg(self.format_attributes(obj, attrname, crop=False)) else: - if hasattr(obj, "sessid") and obj.sessid: + if hasattr(obj, "sessid") and obj.sessid.count(): mergemode = "session" elif self.player_mode: mergemode = "player" diff --git a/src/server/sessionhandler.py b/src/server/sessionhandler.py index db91160376..ac2d091b22 100644 --- a/src/server/sessionhandler.py +++ b/src/server/sessionhandler.py @@ -442,10 +442,10 @@ class ServerSessionHandler(SessionHandler): """ Given a game character, return any matching sessions. """ - sessid = character.sessid - if sessid: - return self.sessions.get(sessid) - return None + sessid = character.sessid.get() + if is_iter(sessid): + return [self.sessions.get(sess) for sess in sessid if sessid in self.sessions] + return self.sessions.get(sessid) def announce_all(self, message): """