Commit 47d63b98 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed python errors.

parent 1263cc01
......@@ -196,9 +196,9 @@ def get_materials(page, per_page):
parts = reformat_user_formula(user_formula)
parts = [part if _atom_label_with_number.match(part) else '%s1' % part for part in parts]
if exclusive:
match_query['formula_reduced_keyword'] = dict(query="".join(sort_elements(elements)))
match_query['formula_reduced_keyword'] = dict(query="".join(sort_elements(parts)))
else:
match_query['formula_reduced_terms'] = dict(query=" ".join(elements), operator='and')
match_query['formula_reduced_terms'] = dict(query=" ".join(parts), operator='and')
elif user_elements is not None:
try:
......@@ -206,11 +206,11 @@ def get_materials(page, per_page):
except Exception:
raise InvalidEncRequest("Could not parse given elements %s." % user_elements, 400)
elif elements is not None:
if exclusive:
match_query['atom_labels_keyword'] = dict(query="".join(sort_elements(elements)))
else:
match_query['atom_labels_terms'] = dict(query=" ".join(elements), operator='and')
if elements is not None:
if exclusive:
match_query['atom_labels_keyword'] = dict(query="".join(sort_elements(elements)))
else:
match_query['atom_labels_terms'] = dict(query=" ".join(elements), operator='and')
# create filters
filter_queries = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment