瀏覽代碼

Bug Fix on the Relation class instanciation

Roland Haroutiounian 8 年之前
父節點
當前提交
aeacf2bf89
共有 2 個文件被更改,包括 8 次插入7 次删除
  1. 6
    5
      lodel/leapi/datahandlers/references/relation.py
  2. 2
    2
      test_em.py

+ 6
- 5
lodel/leapi/datahandlers/references/relation.py 查看文件

@@ -9,13 +9,14 @@ class DataHandler(FieldDataHandler):
9 9
     # @param datahandler_args dict
10 10
     # @param reference EmField
11 11
     # @param kwargs
12
-    def __init__(self, datahandler, datahandler_args, reference, **kwargs):
13
-
12
+    def __init__(self, **kwargs):
14 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 19
         # Reference
19
-        self.backref_ref = reference
20
+        self.backref_ref = kwargs['data_handler_kwargs']['backreference']
20 21
 
21 22
         super().__init__(**kwargs)

+ 2
- 2
test_em.py 查看文件

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

Loading…
取消
儲存