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")),
|
priv_tuple=("genperms.builder")),
|
||||||
GLOBAL_CMD_TABLE.add_command("@link", commands.objmanip.cmd_link,
|
GLOBAL_CMD_TABLE.add_command("@link", commands.objmanip.cmd_link,
|
||||||
priv_tuple=("genperms.builder")),
|
priv_tuple=("genperms.builder")),
|
||||||
GLOBAL_CMD_TABLE.add_command("@list", commands.info.cmd_list,
|
GLOBAL_CMD_TABLE.add_command("@list", commands.info.cmd_list),
|
||||||
priv_tuple=("genperms.process_control")),
|
|
||||||
GLOBAL_CMD_TABLE.add_command("@name", commands.objmanip.cmd_name),
|
GLOBAL_CMD_TABLE.add_command("@name", commands.objmanip.cmd_name),
|
||||||
GLOBAL_CMD_TABLE.add_command("@nextfree", commands.objmanip.cmd_nextfree,
|
GLOBAL_CMD_TABLE.add_command("@nextfree", commands.objmanip.cmd_nextfree,
|
||||||
priv_tuple=("genperms.builder")),
|
priv_tuple=("genperms.builder")),
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ def cmd_page(command):
|
||||||
"""
|
"""
|
||||||
session = command.session
|
session = command.session
|
||||||
pobject = session.get_pobject()
|
pobject = session.get_pobject()
|
||||||
args = command.command_argument.split()
|
|
||||||
targets = []
|
|
||||||
|
|
||||||
# Get the last paged person(s)
|
# Get the last paged person(s)
|
||||||
last_paged_objects = get_last_paged_objects(pobject)
|
last_paged_objects = get_last_paged_objects(pobject)
|
||||||
|
|
||||||
|
|
@ -51,6 +48,9 @@ def cmd_page(command):
|
||||||
session.msg("You have not paged anyone.")
|
session.msg("You have not paged anyone.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
args = command.command_argument.split()
|
||||||
|
targets = []
|
||||||
|
|
||||||
# Build a list of targets
|
# Build a list of targets
|
||||||
# If there are no targets, then set the targets to the last person they
|
# If there are no targets, then set the targets to the last person they
|
||||||
# paged.
|
# paged.
|
||||||
|
|
@ -66,7 +66,6 @@ def cmd_page(command):
|
||||||
limit_types=[defines_global.OTYPE_PLAYER])
|
limit_types=[defines_global.OTYPE_PLAYER])
|
||||||
if matched_object:
|
if matched_object:
|
||||||
targets.append(matched_object[0])
|
targets.append(matched_object[0])
|
||||||
print "MATCH:", matched_object[0]
|
|
||||||
else:
|
else:
|
||||||
# search returned None
|
# search returned None
|
||||||
session.msg("Player '%s' can not be found." % (
|
session.msg("Player '%s' can not be found." % (
|
||||||
|
|
@ -77,7 +76,8 @@ def cmd_page(command):
|
||||||
if command.arg_has_target():
|
if command.arg_has_target():
|
||||||
message = command.get_arg_target_value()
|
message = command.get_arg_target_value()
|
||||||
else:
|
else:
|
||||||
message = command.command_argument
|
session.msg("Page them what?")
|
||||||
|
return
|
||||||
|
|
||||||
sender_name = pobject.get_name(show_dbref=False)
|
sender_name = pobject.get_name(show_dbref=False)
|
||||||
# Build our messages
|
# Build our messages
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ class ObjectManager(models.Manager):
|
||||||
"""
|
"""
|
||||||
Is the input a well-formed dbref number?
|
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):
|
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?
|
Is the input a well-formed dbref number?
|
||||||
"""
|
"""
|
||||||
|
# Strip the leading # sign if it's there.
|
||||||
|
if dbstring.startswith("#"):
|
||||||
|
dbstring = dbstring[1:]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
number = int(dbstring[1:])
|
# If this fails, it's probably not valid.
|
||||||
|
number = int(dbstring)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not dbstring.startswith("#"):
|
# Numbers less than 1 are not valid dbrefs.
|
||||||
return False
|
if number < 1:
|
||||||
elif number < 1:
|
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue