|
@@ -75,6 +75,8 @@ class Model(object):
|
75
|
75
|
component.check()
|
76
|
76
|
except EmComponentCheckError as e:
|
77
|
77
|
raise EmComponentCheckError("The component with uid %d is not valid. Check returns the following error : \"%s\"" % (uid, str(e)))
|
|
78
|
+ #Everything is done. Indicating that the component initialisation is over
|
|
79
|
+ component.init_ended()
|
78
|
80
|
|
79
|
81
|
## Saves data using the current backend
|
80
|
82
|
def save(self):
|
|
@@ -115,6 +117,7 @@ class Model(object):
|
115
|
117
|
# @param component_type str : a component type ( component_class, component_fieldgroup, component_field or component_type )
|
116
|
118
|
# @param datas dict : the options needed by the component creation
|
117
|
119
|
# @throw ValueError if datas['rank'] is not valid (too big or too small, not an integer nor 'last' or 'first' )
|
|
120
|
+ # @todo Handle a raise from the migration handler
|
118
|
121
|
def create_component(self, component_type, datas):
|
119
|
122
|
|
120
|
123
|
em_obj = self.emclass_from_name(component_type)
|
|
@@ -134,13 +137,23 @@ class Model(object):
|
134
|
137
|
if rank != 'last':
|
135
|
138
|
em_component.set_rank( 1 if rank == 'first' else rank)
|
136
|
139
|
|
|
140
|
+ #everything done, indicating that initialisation is over
|
|
141
|
+ em_component.init_ended()
|
|
142
|
+
|
|
143
|
+ #register the creation in migration handler
|
|
144
|
+ self.migration_handler.register_change(em_component.uid, None, em_component.attr_dump)
|
|
145
|
+
|
137
|
146
|
return em_component
|
138
|
147
|
|
139
|
148
|
## Delete a component
|
140
|
149
|
# @param uid int : Component identifier
|
141
|
150
|
# @throw EditorialModel.components.EmComponentNotExistError
|
142
|
151
|
# @todo unable uid check
|
|
152
|
+ # @todo Handle a raise from the migration handler
|
143
|
153
|
def delete_component(self, uid):
|
|
154
|
+ #register the deletion in migration handler
|
|
155
|
+ self.migration_handler.register_change(uid, self.component(uid).attr_dump, None)
|
|
156
|
+
|
144
|
157
|
if uid not in self._components[uid]:
|
145
|
158
|
raise EditorialModel.components.EmComponentNotExistError()
|
146
|
159
|
em_component = self._components[uid]
|