mirror of
https://github.com/evennia/evennia.git
synced 2026-04-07 00:45:22 +02:00
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
|
|
@ -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