Fixed some lingering uses of sessid as a non-handler.

This commit is contained in:
Griatch 2014-08-05 09:16:00 +02:00
parent 5d08d3b3fb
commit 306ce17022
2 changed files with 10 additions and 10 deletions

View file

@ -1649,8 +1649,8 @@ class CmdExamine(ObjManipCommand):
string = "\n{wName/key{n: {c%s{n (%s)" % (obj.name, obj.dbref) string = "\n{wName/key{n: {c%s{n (%s)" % (obj.name, obj.dbref)
if hasattr(obj, "aliases") and obj.aliases.all(): if hasattr(obj, "aliases") and obj.aliases.all():
string += "\n{wAliases{n: %s" % (", ".join(utils.make_iter(str(obj.aliases)))) string += "\n{wAliases{n: %s" % (", ".join(utils.make_iter(str(obj.aliases))))
if hasattr(obj, "sessid") and obj.sessid: if hasattr(obj, "sessid") and obj.sessid.count():
string += "\n{wsession{n: %s" % obj.sessid string += "\n{wsession{n: %s" % obj.sessid.get()
elif hasattr(obj, "sessions") and obj.sessions: elif hasattr(obj, "sessions") and obj.sessions:
string += "\n{wsession(s){n: %s" % (", ".join(str(sess.sessid) string += "\n{wsession(s){n: %s" % (", ".join(str(sess.sessid)
for sess in obj.sessions)) for sess in obj.sessions))
@ -1709,12 +1709,12 @@ class CmdExamine(ObjManipCommand):
# if we merge on the object level. # if we merge on the object level.
if hasattr(obj, "player") and obj.player: if hasattr(obj, "player") and obj.player:
all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.cmdset.all()]) all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.cmdset.all()])
if obj.sessid: if obj.sessid.count():
all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.get_session(obj.sessid).cmdset.all()]) all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.player.get_session(obj.sessid.get()).cmdset.all()])
else: else:
try: try:
# we have to protect this since many objects don't have sessions. # 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): except (TypeError, AttributeError):
pass pass
all_cmdsets = [cmdset for cmdset in dict(all_cmdsets).values()] all_cmdsets = [cmdset for cmdset in dict(all_cmdsets).values()]
@ -1818,7 +1818,7 @@ class CmdExamine(ObjManipCommand):
# we are only interested in specific attributes # we are only interested in specific attributes
caller.msg(self.format_attributes(obj, attrname, crop=False)) caller.msg(self.format_attributes(obj, attrname, crop=False))
else: else:
if hasattr(obj, "sessid") and obj.sessid: if hasattr(obj, "sessid") and obj.sessid.count():
mergemode = "session" mergemode = "session"
elif self.player_mode: elif self.player_mode:
mergemode = "player" mergemode = "player"

View file

@ -442,10 +442,10 @@ class ServerSessionHandler(SessionHandler):
""" """
Given a game character, return any matching sessions. Given a game character, return any matching sessions.
""" """
sessid = character.sessid sessid = character.sessid.get()
if sessid: if is_iter(sessid):
return [self.sessions.get(sess) for sess in sessid if sessid in self.sessions]
return self.sessions.get(sessid) return self.sessions.get(sessid)
return None
def announce_all(self, message): def announce_all(self, message):
""" """