Fix search bug when an empty list of objects_id was passed

This makes it so we're explicitly checking for one being passed
so when an empty list is passed it fails.
master
Eric Holscher 2019-02-26 15:56:13 -03:00
parent 90066976d7
commit a325feb2a2
1 changed files with 4 additions and 1 deletions

View File

@ -14,7 +14,10 @@ def index_objects_to_es(
app_label, model_name, document_class, index_name=None, chunk=None, objects_id=None
):
assert not (chunk and objects_id), "You can not pass both chunk and objects_id"
assert not (chunk and objects_id), \
"You can not pass both chunk and objects_id"
assert (chunk or objects_id), \
"You must pass a chunk or objects_id"
model = apps.get_model(app_label, model_name)
document = _get_document(model=model, document_class=document_class)