Add use_dbref kwarg for turning off #dbref lookup in obj.search. Resolves #990.

This commit is contained in:
Griatch 2016-08-19 22:14:51 +02:00
parent a3c2c1502e
commit d76b7b0454

View file

@ -276,10 +276,10 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
exact=False, exact=False,
candidates=None, candidates=None,
nofound_string=None, nofound_string=None,
multimatch_string=None): multimatch_string=None,
use_dbref=True):
""" """
Returns the typeclass of an `Object` matching a search Returns an Object matching a search string/condition
string/condition
Perform a standard object search in the database, handling Perform a standard object search in the database, handling
multiple results and lack thereof gracefully. By default, only multiple results and lack thereof gracefully. By default, only
@ -328,6 +328,8 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
caller's contents (inventory). caller's contents (inventory).
nofound_string (str): optional custom string for not-found error message. nofound_string (str): optional custom string for not-found error message.
multimatch_string (str): optional custom string for multimatch error header. multimatch_string (str): optional custom string for multimatch error header.
use_dbref (bool, optional): if False, treat a given #dbref strings as a
normal string rather than database ids.
Returns: Returns:
match (Object, None or list): will return an Object/None if `quiet=False`, match (Object, None or list): will return an Object/None if `quiet=False`,
@ -383,7 +385,8 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
attribute_name=attribute_name, attribute_name=attribute_name,
typeclass=typeclass, typeclass=typeclass,
candidates=candidates, candidates=candidates,
exact=exact) exact=exact,
use_dbref=use_dbref)
if quiet: if quiet:
return results return results
return _AT_SEARCH_RESULT(results, self, query=searchdata, return _AT_SEARCH_RESULT(results, self, query=searchdata,