瀏覽代碼

Bugfix on LeRelation fieldtypes

Yann Weber 9 年之前
父節點
當前提交
6634ae34ef
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 4
    2
      EditorialModel/fieldtypes/leo.py
  2. 1
    1
      EditorialModel/fieldtypes/naturerelation.py

+ 4
- 2
EditorialModel/fieldtypes/leo.py 查看文件

@@ -1,5 +1,8 @@
1 1
 #-*- coding: utf-8 -*-
2 2
 
3
+import leapi.letype as letype
4
+import leapi.leclass as leclass
5
+
3 6
 from .generic import GenericFieldType
4 7
 
5 8
 class EmFieldType(GenericFieldType):
@@ -12,10 +15,9 @@ class EmFieldType(GenericFieldType):
12 15
         super(EmFieldType, self).__init__(ftype = 'leobject', **kwargs)
13 16
 
14 17
     def _check_data_value(self, value):
15
-        import leapi.lecrud as lecrud
16 18
         err = None
17 19
         if not isinstance(value, int):
18
-            if not isinstance(value, lecrud._LeCrud.name2class('LeType')):
20
+            if not isinstance(value, letype._LeType):
19 21
                 return (None, ValueError("An instance of a child class of LeType was expected"))
20 22
             if not hasattr(value, 'lodel_id'):
21 23
                 return (None, ValueError("The LeType instance given has no lodel_id !"))

+ 1
- 1
EditorialModel/fieldtypes/naturerelation.py 查看文件

@@ -14,7 +14,7 @@ class EmFieldType(EmFieldType):
14 14
         super(EmFieldType, self).__init__(**kwargs)
15 15
 
16 16
     def check_data_value(self, value):
17
-        return value is None or ( value in classtypes.getall())
17
+        return value is None or ( value in classtypes.EmNature.getall())
18 18
 
19 19
     def check_data_consistency(self, lec, fname, datas):
20 20
         #Checking given component

Loading…
取消
儲存