Fixed an issue with Object manager's is_dbref. Paging should be a lot more sound now too.
This commit is contained in:
parent
9246ce684f
commit
914628d385
4 changed files with 17 additions and 14 deletions
|
|
@ -91,8 +91,7 @@ GLOBAL_CMD_TABLE.add_command("@find", commands.objmanip.cmd_find,
|
|||
priv_tuple=("genperms.builder")),
|
||||
GLOBAL_CMD_TABLE.add_command("@link", commands.objmanip.cmd_link,
|
||||
priv_tuple=("genperms.builder")),
|
||||
GLOBAL_CMD_TABLE.add_command("@list", commands.info.cmd_list,
|
||||
priv_tuple=("genperms.process_control")),
|
||||
GLOBAL_CMD_TABLE.add_command("@list", commands.info.cmd_list),
|
||||
GLOBAL_CMD_TABLE.add_command("@name", commands.objmanip.cmd_name),
|
||||
GLOBAL_CMD_TABLE.add_command("@nextfree", commands.objmanip.cmd_nextfree,
|
||||
priv_tuple=("genperms.builder")),
|
||||
|
|
|
|||
|
|
@ -34,12 +34,9 @@ def cmd_page(command):
|
|||
"""
|
||||
session = command.session
|
||||
pobject = session.get_pobject()
|
||||
args = command.command_argument.split()
|
||||
targets = []
|
||||
|
||||
# Get the last paged person(s)
|
||||
last_paged_objects = get_last_paged_objects(pobject)
|
||||
|
||||
|
||||
# If they don't give a target, or any data to send to the target
|
||||
# then tell them who they last paged if they paged someone, if not
|
||||
# tell them they haven't paged anyone.
|
||||
|
|
@ -50,6 +47,9 @@ def cmd_page(command):
|
|||
return
|
||||
session.msg("You have not paged anyone.")
|
||||
return
|
||||
|
||||
args = command.command_argument.split()
|
||||
targets = []
|
||||
|
||||
# Build a list of targets
|
||||
# If there are no targets, then set the targets to the last person they
|
||||
|
|
@ -66,7 +66,6 @@ def cmd_page(command):
|
|||
limit_types=[defines_global.OTYPE_PLAYER])
|
||||
if matched_object:
|
||||
targets.append(matched_object[0])
|
||||
print "MATCH:", matched_object[0]
|
||||
else:
|
||||
# search returned None
|
||||
session.msg("Player '%s' can not be found." % (
|
||||
|
|
@ -77,7 +76,8 @@ def cmd_page(command):
|
|||
if command.arg_has_target():
|
||||
message = command.get_arg_target_value()
|
||||
else:
|
||||
message = command.command_argument
|
||||
session.msg("Page them what?")
|
||||
return
|
||||
|
||||
sender_name = pobject.get_name(show_dbref=False)
|
||||
# Build our messages
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ class ObjectManager(models.Manager):
|
|||
"""
|
||||
Is the input a well-formed dbref number?
|
||||
"""
|
||||
util_object.is_dbref(dbstring)
|
||||
return util_object.is_dbref(dbstring)
|
||||
|
||||
def dbref_search(self, dbref_string, limit_types=False):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,16 +6,20 @@ def is_dbref(dbstring):
|
|||
"""
|
||||
Is the input a well-formed dbref number?
|
||||
"""
|
||||
# Strip the leading # sign if it's there.
|
||||
if dbstring.startswith("#"):
|
||||
dbstring = dbstring[1:]
|
||||
|
||||
try:
|
||||
number = int(dbstring[1:])
|
||||
# If this fails, it's probably not valid.
|
||||
number = int(dbstring)
|
||||
except ValueError:
|
||||
return False
|
||||
except TypeError:
|
||||
return False
|
||||
|
||||
if not dbstring.startswith("#"):
|
||||
return False
|
||||
elif number < 1:
|
||||
|
||||
# Numbers less than 1 are not valid dbrefs.
|
||||
if number < 1:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue