mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 09:46:32 +01:00
Made some extra opt-out checking in object manager.
This commit is contained in:
parent
ca11e7de44
commit
befe6a6db0
1 changed files with 4 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ from django.db.models.fields import exceptions
|
|||
from src.typeclasses.managers import TypedObjectManager
|
||||
from src.typeclasses.managers import returns_typeclass, returns_typeclass_list
|
||||
from src.utils import utils
|
||||
from src.utils.utils import to_unicode, make_iter, string_partial_matching
|
||||
from src.utils.utils import to_unicode, is_iter, make_iter, string_partial_matching
|
||||
|
||||
__all__ = ("ObjectManager",)
|
||||
_GA = object.__getattribute__
|
||||
|
|
@ -190,6 +190,9 @@ class ObjectManager(TypedObjectManager):
|
|||
ostring = ostring.key
|
||||
else:
|
||||
return []
|
||||
if is_iter(candidates) and not len(candidates):
|
||||
# if candidates is an empty iterable there can be no matches. Exit early.
|
||||
return []
|
||||
|
||||
# build query objects
|
||||
candidates_id = [_GA(obj, "id") for obj in make_iter(candidates) if obj]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue