diff --git a/EditorialModel/fieldgroups.py b/EditorialModel/fieldgroups.py index 0ecc730..823a88c 100644 --- a/EditorialModel/fieldgroups.py +++ b/EditorialModel/fieldgroups.py @@ -16,6 +16,12 @@ class EmFieldGroup(EmComponent): ## List of fields _fields = [('class_id', ftypes.EmField_integer)] + ## Check if the EmFieldGroup is valid + # @return True if valid False if not + def check(self): + super(EmFieldGroup, self).check() + return True + ## Deletes a fieldgroup # @return True if the deletion is a success, False if not def delete(self): @@ -24,7 +30,10 @@ class EmFieldGroup(EmComponent): if len(fieldgroup_fields) > 0: raise NotEmptyError("This Fieldgroup still contains fields. It can't be deleted then") # then we delete this fieldgroup - return self.model.delete_component(self.uid) + if self.model.delete_component(self.uid): + return self.check() + else: + return False ## Get the list of associated fields # if type_id, the fields will be filtered to represent selected fields of this EmType diff --git a/EditorialModel/fields.py b/EditorialModel/fields.py index d38dea6..dd86771 100644 --- a/EditorialModel/fields.py +++ b/EditorialModel/fields.py @@ -24,8 +24,17 @@ class EmField(EmComponent): def __init__(self, datas, model): super(EmField, self).__init__(datas, model) + ## Check if the EmField is valid + # @return True if valid False if not + def check(self): + super(EmField, self).check() + return True + ## @brief Delete a field if it's not linked # @return bool : True if deleted False if deletion aborded # @todo Check if unconditionnal deletion is correct def delete(self): - return self.model.delete_component(self.uid) + if self.model.delete_component(self.uid): + return self.check() + else: + return False