From 18a36848f338e75e5d7f2fabf1bba989c8368242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <htomwoe@gwdg.de> Date: Sun, 10 Feb 2019 20:42:24 +0100 Subject: [PATCH] ENH: set prop --- src/caosadvancedtools/cfood.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py index c0998927..892abc49 100644 --- a/src/caosadvancedtools/cfood.py +++ b/src/caosadvancedtools/cfood.py @@ -77,21 +77,11 @@ class AbstractCFood(object): @staticmethod # move to api? def set_property(entity, prop, value): - if entity.get_property(prop) is None: - entity.add_property(prop, value) - else: - if entity.get_property(prop).value == value: - return - else: - entity.get_property(prop).value = value - - @staticmethod - # move to api? - def set_property(entity, name, value): - if entity.get_property(name) is not None: - entity.remove_property(name) + # TODO only do something when it is necessary? - entity.add_property(get_entity(name), value=value) + while entity.get_property(prop) is not None: + entity.remove_property(prop) + entity.add_property(prop, value) @staticmethod def find_existing(entity): -- GitLab