Skip to content

Commit

Permalink
Remove duplicate dbref implementation in comms-manager. Resolves #2054
Browse files Browse the repository at this point in the history
  • Loading branch information
Griatch committed Feb 12, 2020
1 parent fc2fbe9 commit 5644eaf
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions evennia/comms/managers.py
Expand Up @@ -8,6 +8,7 @@
from django.db.models import Q
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
from evennia.utils import logger
from evennia.utils.utils import dbref

_GA = object.__getattribute__
_AccountDB = None
Expand All @@ -31,32 +32,6 @@ class CommError(Exception):
#


def dbref(inp, reqhash=True):
"""
Valid forms of dbref (database reference number) are either a
string '#N' or an integer N.
Args:
inp (int or str): A possible dbref to check syntactically.
reqhash (bool): Require an initial hash `#` to accept.
Returns:
is_dbref (int or None): The dbref integer part if a valid
dbref, otherwise `None`.
"""
if reqhash and not (isinstance(inp, str) and inp.startswith("#")):
return None
if isinstance(inp, str):
inp = inp.lstrip("#")
try:
if int(inp) < 0:
return None
except Exception:
return None
return inp


def identify_object(inp):
"""
Helper function. Identifies if an object is an account or an object;
Expand Down

0 comments on commit 5644eaf

Please sign in to comment.