Browse Source

Working for all tests

prieto 8 years ago
parent
commit
0dddf1146f
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      lodel/editorial_model/translator/xmlfile.py

+ 9
- 3
lodel/editorial_model/translator/xmlfile.py View File

@@ -205,11 +205,11 @@ def load(filename):
205 205
             model.add_class(em_class)
206 206
     
207 207
     groups = emodel.find('groups')
208
+    i = 0
208 209
     for group in groups:
209 210
         grp = load_group_xml(model, group)
210 211
         if grp.uid not in model.all_groups():
211 212
             grp = model.add_group(grp)
212
-
213 213
     return model
214 214
 
215 215
 ##@brief Creates a EmClass from a xml description
@@ -241,7 +241,10 @@ def load_class_xml(model, elem):
241 241
                 requires.append(model.add_class(EmClass(r)))
242 242
     group = elem.find('group')
243 243
     if group.text is not None:
244
-        grp = model.add_group(EmGroup(group.text))
244
+        if group.text in model.all_groups():
245
+            grp = model.all_groups_ref(group.text)
246
+        else:
247
+            grp = model.add_group(EmGroup(group.text))
245 248
     else:
246 249
         grp = None
247 250
 
@@ -289,7 +292,10 @@ def load_field_xml(model, elem):
289 292
         
290 293
     emgroup = elem.find('group')
291 294
     if emgroup.text is not None:
292
-        group = model.add_group(EmGroup(emgroup.text))
295
+        if emgroup.text in model.all_groups():
296
+            group = model.all_groups_ref(emgroup.text)
297
+        else:
298
+            group = model.add_group(EmGroup(emgroup.text))
293 299
     else:
294 300
         group = None
295 301
         

Loading…
Cancel
Save