Skip to content
Snippets Groups Projects
Commit e243ad08 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: allow to set datatype of LIST property

parent a93fa102
No related branches found
No related tags found
No related merge requests found
......@@ -212,7 +212,7 @@ class AbstractCFood(object):
def assure_object_is_in_list(obj, containing_object, property_name,
to_be_updated, verbosity=INFO):
to_be_updated, datatype=None, verbosity=INFO):
"""
Checks whether `obj` is one of the values in the list property
`property_name` of the supplied entity containing_object`.
......@@ -228,8 +228,10 @@ def assure_object_is_in_list(obj, containing_object, property_name,
"""
if containing_object.get_property(property_name) is None:
if datatype is None:
datatype = db.LIST(property_name)
containing_object.add_property(property_name, value=[],
datatype=db.LIST(property_name))
datatype=datatype)
current_list = containing_object.get_property(property_name).value
if not isinstance(current_list, list):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment