Browse Source

EmType: bugfix, maybe we should learn python :p

ArnAud 9 years ago
parent
commit
5fabf34ddb
2 changed files with 5 additions and 4 deletions
  1. 2
    1
      EditorialModel/model.py
  2. 3
    3
      EditorialModel/types.py

+ 2
- 1
EditorialModel/model.py View File

@@ -245,10 +245,11 @@ class Model(object):
245 245
                 new_me.component(uid).select_field(new_me.component(field_id))
246 246
 
247 247
         # add superiors to types
248
-        # TODO: debug, this add a superior to all types !
249 248
         for superiors_list in relations['superiors_list']:
250 249
             uid, sup_list = superiors_list
251 250
             for nature, superior_uid in sup_list.items():
252 251
                 new_me.component(uid).add_superior(new_me.component(superior_uid), nature)
253 252
 
253
+        del new_me
254
+
254 255
         self.migration_handler = new_mh

+ 3
- 3
EditorialModel/types.py View File

@@ -25,16 +25,16 @@ class EmType(EmComponent):
25 25
     ## Instanciate a new EmType
26 26
     # @todo define and check types for icon and sortcolumn
27 27
     # @todo better check self.subordinates
28
-    def __init__(self, model, uid, name, class_id, fields_list = [], superiors_list = {}, icon = '0', sortcolumn = 'rank', string = None, help_text = None, date_update = None, date_create = None, rank = None):
28
+    def __init__(self, model, uid, name, class_id, fields_list = None, superiors_list = None, icon = '0', sortcolumn = 'rank', string = None, help_text = None, date_update = None, date_create = None, rank = None):
29 29
         self.class_id = class_id
30 30
         self.check_type('class_id', int)
31
-        self.fields_list = fields_list
31
+        self.fields_list = fields_list if fields_list is not None else []
32 32
         self.check_type('fields_list', list)
33 33
         for l_uid in self.fields_list:
34 34
             if not isinstance(l_uid, int):
35 35
                 raise AttributeError("Excepted fields_list to be a list of integers, but found a +"+str(type(l_uid))+" in it")
36 36
 
37
-        self.superiors_list = superiors_list
37
+        self.superiors_list = superiors_list if superiors_list is not None else {}
38 38
         self.check_type('superiors_list', dict)
39 39
         for nature, sup_uid in self.superiors_list.items():
40 40
             if nature not in [EmNature.PARENT, EmNature.TRANSLATION, EmNature.IDENTITY]:

Loading…
Cancel
Save