Преглед на файлове

Bugfixes in XmlFile translator & in base_classes datahandlers

Yann Weber преди 8 години
родител
ревизия
52c60a9f63
променени са 5 файла, в които са добавени 10 реда и са изтрити 10 реда
  1. Двоични данни
      examples/em_test.pickle
  2. 8
    7
      lodel/editorial_model/translator/xmlfile.py
  3. 0
    1
      lodel/leapi/datahandlers/base_classes.py
  4. 2
    2
      plugins/webui/templates/listing/show_object.html
  5. Двоични данни
      tests/editorial_model.pickle

Двоични данни
examples/em_test.pickle Целия файл


+ 8
- 7
lodel/editorial_model/translator/xmlfile.py Целия файл

374
     for opt in elem:
374
     for opt in elem:
375
         if (opt.tag == 'allowed_classes'):
375
         if (opt.tag == 'allowed_classes'):
376
             classes = list()
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
             dhdl_options['allowed_classes'] = classes
385
             dhdl_options['allowed_classes'] = classes
385
         elif (opt.tag == 'back_reference'):
386
         elif (opt.tag == 'back_reference'):
386
             dhdl_options['back_reference'] = tuple(opt.text.split(','))
387
             dhdl_options['back_reference'] = tuple(opt.text.split(','))

+ 0
- 1
lodel/leapi/datahandlers/base_classes.py Целия файл

194
     def __init__(self, allowed_classes = None, back_reference = None, internal=False, **kwargs):
194
     def __init__(self, allowed_classes = None, back_reference = None, internal=False, **kwargs):
195
         self.__allowed_classes = [] if allowed_classes is None else set(allowed_classes)
195
         self.__allowed_classes = [] if allowed_classes is None else set(allowed_classes)
196
         logger.warning("We're going to inialize an temporary attribute, don't forget to fix this issue")
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
         if back_reference is not None:
197
         if back_reference is not None:
199
             if len(back_reference) != 2:
198
             if len(back_reference) != 2:
200
                 raise ValueError("A tuple (classname, fieldname) expected but got '%s'" % back_reference)
199
                 raise ValueError("A tuple (classname, fieldname) expected but got '%s'" % back_reference)

+ 2
- 2
plugins/webui/templates/listing/show_object.html Целия файл

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

Двоични данни
tests/editorial_model.pickle Целия файл


Loading…
Отказ
Запис