mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge branch 'master' into develop
This commit is contained in:
commit
170db66d2c
1 changed files with 4 additions and 2 deletions
|
|
@ -383,10 +383,12 @@ def search_prototype(key=None, tags=None, require_single=False, return_iterators
|
|||
else:
|
||||
mod_matches = _MODULE_PROTOTYPES
|
||||
|
||||
allow_fuzzy = True
|
||||
if key:
|
||||
if key in mod_matches:
|
||||
# exact match
|
||||
module_prototypes = [mod_matches[key]]
|
||||
allow_fuzzy = False
|
||||
else:
|
||||
# fuzzy matching
|
||||
module_prototypes = [
|
||||
|
|
@ -410,7 +412,7 @@ def search_prototype(key=None, tags=None, require_single=False, return_iterators
|
|||
if key:
|
||||
# exact or partial match on key
|
||||
exact_match = db_matches.filter(Q(db_key__iexact=key)).order_by("db_key")
|
||||
if not exact_match:
|
||||
if not exact_match and allow_fuzzy:
|
||||
# try with partial match instead
|
||||
db_matches = db_matches.filter(Q(db_key__icontains=key)).order_by("db_key")
|
||||
else:
|
||||
|
|
@ -427,7 +429,7 @@ def search_prototype(key=None, tags=None, require_single=False, return_iterators
|
|||
nmodules = len(module_prototypes)
|
||||
ndbprots = db_matches.count()
|
||||
if nmodules + ndbprots != 1:
|
||||
raise KeyError(f"Found {nmodules + ndbprots} matching prototypes.")
|
||||
raise KeyError(f"Found {nmodules + ndbprots} matching prototypes {module_prototypes}.")
|
||||
|
||||
if return_iterators:
|
||||
# trying to get the entire set of prototypes - we must paginate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue