Browse Source

Bugfixes in XmlFile translator & in base_classes datahandlers

Yann Weber 8 years ago
parent
commit
52c60a9f63

BIN
examples/em_test.pickle View File


+ 8
- 7
lodel/editorial_model/translator/xmlfile.py View File

@@ -374,13 +374,14 @@ def load_dhdl_options_xml(model, elem):
374 374
     for opt in elem:
375 375
         if (opt.tag == 'allowed_classes'):
376 376
             classes = list()
377
-            clss = opt.text.split(',')
378
-            for classe in clss:
379
-                if classe in model.all_classes():
380
-                    classes.append(model.all_classes_ref(classe))
381
-                else:
382
-                    new_cls = model.add_class(EmClass(classe))
383
-                    classes.append(new_cls)
377
+            if opt.text is not None:
378
+                clss = opt.text.split(',')
379
+                for classe in clss:
380
+                    if classe in model.all_classes():
381
+                        classes.append(model.all_classes_ref(classe))
382
+                    else:
383
+                        new_cls = model.add_class(EmClass(classe))
384
+                        classes.append(new_cls)
384 385
             dhdl_options['allowed_classes'] = classes
385 386
         elif (opt.tag == 'back_reference'):
386 387
             dhdl_options['back_reference'] = tuple(opt.text.split(','))

+ 0
- 1
lodel/leapi/datahandlers/base_classes.py View File

@@ -194,7 +194,6 @@ class Reference(DataHandler):
194 194
     def __init__(self, allowed_classes = None, back_reference = None, internal=False, **kwargs):
195 195
         self.__allowed_classes = [] if allowed_classes is None else set(allowed_classes)
196 196
         logger.warning("We're going to inialize an temporary attribute, don't forget to fix this issue")
197
-        self.allowed_classes = None if allowed_classes is None else allowed_classes.pop() ## WARNING : just here for step over the issue with __allowed_classes
198 197
         if back_reference is not None:
199 198
             if len(back_reference) != 2:
200 199
                 raise ValueError("A tuple (classname, fieldname) expected but got '%s'" % back_reference)

+ 2
- 2
plugins/webui/templates/listing/show_object.html View File

@@ -21,7 +21,7 @@
21 21
                     <li>{{ fieldname }}
22 22
                         <ul>
23 23
                     {% for rel in obj.data(fieldname) %}
24
-                            {% set l_classe = fieldvalue.allowed_classes %}
24
+                            {% set l_classe = fieldvalue.linked_classes() %}
25 25
                             <li><a href="show_object?classname={{ l_classe.__name__ }}&lodel_id={{ rel|int }}" target="_blank">{{ rel|int }}</a></li>
26 26
                     {% endfor %}
27 27
                         </ul></li>
@@ -32,4 +32,4 @@
32 32
         {% endif %}
33 33
     {% endfor %}
34 34
 </ul>
35
-{% endblock %}
35
+{% endblock %}

BIN
tests/editorial_model.pickle View File


Loading…
Cancel
Save