Some further fixes.

This commit is contained in:
Griatch 2013-02-14 17:55:05 +01:00
parent e345d659fd
commit 4dea96f5e4
4 changed files with 20 additions and 4 deletions

View file

@ -1614,6 +1614,10 @@ class CmdExamine(ObjManipCommand):
string = "\n{wName/key{n: {c%s{n (%s)" % (obj.name, obj.dbref)
if hasattr(obj, "aliases") and obj.aliases:
string += "\n{wAliases{n: %s" % (", ".join(utils.make_iter(obj.aliases)))
if hasattr(obj, "sessid") and obj.sessid:
string += "\n{wsession{n: %s" % obj.sessid
elif hasattr(obj, "sessions") and obj.sessions:
string += "\n{wsession(s){n: %s" % (", ".join(str(sess.sessid) for sess in obj.sessions))
if hasattr(obj, "has_player") and obj.has_player:
string += "\n{wPlayer{n: {c%s{n" % obj.player.name
perms = obj.player.permissions

View file

@ -156,7 +156,11 @@ class CmdPy(MuxCommand):
'ev':ev,
'inherits_from':utils.inherits_from}
caller.msg(">>> %s" % pycode, data={"raw":True}, sessid=self.sessid)
try:
caller.msg(">>> %s" % pycode, data={"raw":True}, sessid=self.sessid)
except TypeError:
caller.msg(">>> %s" % pycode, data={"raw":True})
mode = "eval"
try:
@ -185,7 +189,11 @@ class CmdPy(MuxCommand):
ret = "\n".join("{n<<< %s" % line for line in errlist if line)
if ret != None:
caller.msg(ret, sessid=self.sessid)
try:
caller.msg(ret, sessid=self.sessid)
except TypeError:
caller.msg(ret)
# helper function. Kept outside so it can be imported and run
# by other commands.

View file

@ -613,7 +613,7 @@ class PlayerDB(TypedObject):
break
return cmdhandler.cmdhandler(self.typeclass, raw_string, sessid=sessid)
def search(self, ostring, return_character=False):
def search(self, ostring, return_character=False, **kwargs):
"""
This is similar to the ObjectDB search method but will search for Players only. Errors
will be echoed, and None returned if no Player is found.
@ -621,6 +621,8 @@ class PlayerDB(TypedObject):
return_character - will try to return the character the player controls instead of
the Player object itself. If no Character exists (since Player is
OOC), None will be returned.
Extra keywords are ignored, but are allowed in call in order to make API more consistent
with objects.models.TypedObject.search.
"""
matches = _GA(self, "__class__").objects.player_search(ostring)
matches = _AT_SEARCH_RESULT(self, ostring, matches, global_search=True)

View file

@ -136,10 +136,12 @@ class Player(TypeClass):
"""
return self.dbobj.execute_cmd(raw_string, sessid=sessid)
def search(self, ostring, return_character=False):
def search(self, ostring, return_character=False, **kwargs):
"""
This method mimicks object.search if self.character is set. Otherwise only
other Players can be searched with this method.
extra keywords are accepted but ignored to make API more consistent with
TypedObject.search.
"""
return self.dbobj.search(ostring, return_character=return_character)