Browse Source

EmModel : create_component() can take an optional uid

ArnAud 9 years ago
parent
commit
ea302bb469
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      EditorialModel/model.py

+ 2
- 2
EditorialModel/model.py View File

@@ -129,7 +129,7 @@ class Model(object):
129 129
     # @param datas dict : the options needed by the component creation
130 130
     # @throw ValueError if datas['rank'] is not valid (too big or too small, not an integer nor 'last' or 'first' )
131 131
     # @todo Handle a raise from the migration handler
132
-    def create_component(self, component_type, datas):
132
+    def create_component(self, component_type, datas, uid=None):
133 133
 
134 134
         em_obj = self.emclass_from_name(component_type)
135 135
 
@@ -138,7 +138,7 @@ class Model(object):
138 138
             rank = datas['rank']
139 139
             del datas['rank']
140 140
 
141
-        datas['uid'] = self.new_uid()
141
+        datas['uid'] = uid if uid else self.new_uid()
142 142
         em_component = em_obj(self, **datas)
143 143
 
144 144
         em_component.rank = em_component.get_max_rank() + 1 #Inserting last by default

Loading…
Cancel
Save