Sfoglia il codice sorgente

Bug Fix on the Relation class instanciation

Roland Haroutiounian 8 anni fa
parent
commit
aeacf2bf89
2 ha cambiato i file con 8 aggiunte e 7 eliminazioni
  1. 6
    5
      lodel/leapi/datahandlers/references/relation.py
  2. 2
    2
      test_em.py

+ 6
- 5
lodel/leapi/datahandlers/references/relation.py Vedi File

9
     # @param datahandler_args dict
9
     # @param datahandler_args dict
10
     # @param reference EmField
10
     # @param reference EmField
11
     # @param kwargs
11
     # @param kwargs
12
-    def __init__(self, datahandler, datahandler_args, reference, **kwargs):
13
-
12
+    def __init__(self, **kwargs):
14
         # Data Handler
13
         # Data Handler
15
-        data_handler_class = FieldDataHandler.from_name(datahandler)
16
-        self.data_handler = data_handler_class(**datahandler_args)
14
+        data_handler = kwargs['data_handler_kwargs']['data_handler']
15
+        data_handler_args = kwargs['data_handler_kwargs']
16
+        data_handler_class = FieldDataHandler.from_name(data_handler)
17
+        self.data_handler = data_handler_class(**data_handler_args)
17
 
18
 
18
         # Reference
19
         # Reference
19
-        self.backref_ref = reference
20
+        self.backref_ref = kwargs['data_handler_kwargs']['backreference']
20
 
21
 
21
         super().__init__(**kwargs)
22
         super().__init__(**kwargs)

+ 2
- 2
test_em.py Vedi File

214
                         data_handler = 'varchar',
214
                         data_handler = 'varchar',
215
                         group = editorial_person_group
215
                         group = editorial_person_group
216
 )
216
 )
217
-"""
217
+
218
 person.new_field(   'linked_texts',
218
 person.new_field(   'linked_texts',
219
                     display_name = {
219
                     display_name = {
220
                         'eng': 'Linked texts',
220
                         'eng': 'Linked texts',
228
                     },
228
                     },
229
                     group = editorial_person_group,
229
                     group = editorial_person_group,
230
 )
230
 )
231
+
231
 text.new_field( 'linked_persons',
232
 text.new_field( 'linked_persons',
232
                 display_name = {
233
                 display_name = {
233
                     'eng': 'Linked persons',
234
                     'eng': 'Linked persons',
242
                 },
243
                 },
243
                 group = editorial_person_group,
244
                 group = editorial_person_group,
244
 )
245
 )
245
-"""
246
 
246
 

Loading…
Annulla
Salva