mirror of
https://github.com/evennia/evennia.git
synced 2026-04-02 14:07:16 +02:00
Return no match if using obj.search() with an empty list of candidates. This accounts for candidate lists that are created dynamically, for example limiting them to the inventory (which may be empy). Resolves #1016.
This commit is contained in:
parent
ca1b76ab02
commit
1da9217a18
3 changed files with 6 additions and 3 deletions
|
|
@ -1155,7 +1155,7 @@ class ContribRPObject(DefaultObject):
|
|||
# only allow exact matching if searching the entire database
|
||||
# or unique #dbrefs
|
||||
exact = True
|
||||
elif not candidates:
|
||||
elif candidates is None:
|
||||
# no custom candidates given - get them automatically
|
||||
if location:
|
||||
# location(s) were given
|
||||
|
|
|
|||
|
|
@ -357,7 +357,10 @@ class ObjectDBManager(TypedObjectManager):
|
|||
typeclasses[i] = u"%s" % typeclass
|
||||
typeclass = typeclasses
|
||||
|
||||
if candidates:
|
||||
if candidates is not None:
|
||||
if not candidates:
|
||||
# candidates is the empty list. This should mean no matches can ever be acquired.
|
||||
return []
|
||||
# Convenience check to make sure candidates are really dbobjs
|
||||
candidates = [cand for cand in make_iter(candidates) if cand]
|
||||
if typeclass:
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
|||
# only allow exact matching if searching the entire database
|
||||
# or unique #dbrefs
|
||||
exact = True
|
||||
elif not candidates:
|
||||
elif candidates is None:
|
||||
# no custom candidates given - get them automatically
|
||||
if location:
|
||||
# location(s) were given
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue