From 083daf67db571e909a34183571acc3ee0cfb5e96 Mon Sep 17 00:00:00 2001 From: Roland Haroutiounian Date: Fri, 24 Jul 2015 11:16:02 +0200 Subject: [PATCH] [#44] EmType : Added a check method and its call in the delete process --- EditorialModel/types.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/EditorialModel/types.py b/EditorialModel/types.py index 9b6c998..60dfe4b 100644 --- a/EditorialModel/types.py +++ b/EditorialModel/types.py @@ -53,6 +53,12 @@ class EmType(EmComponent): def create(cls, name, em_class, sortcolumn='rank', **em_component_args): return super(EmType, cls).create(name=name, class_id=em_class.uid, sortcolumn=sortcolumn, **em_component_args) + ## Checks if the EmType is valid + # @return Bool : True if valid, False if not + def check(self): + super(EmType, self).check() + return True + @property ## Return the EmClassType of the type # @return EditorialModel.classtypes.* @@ -79,7 +85,10 @@ class EmType(EmComponent): for nature, sups in self.superiors().items(): for sup in sups: self.del_superior(sup, nature) - return super(EmType, self).delete() + if super(EmType, self).delete(): + return self.check() + else: + return False ## Get the list of non empty associated fieldgroups # @return A list of EmFieldGroup instance