Procházet zdrojové kódy

Bugfix on LeType.check_or_raise() method

When complete was True the method was expecting optionnal field in datas
Yann Weber před 9 roky
rodič
revize
077a54423d
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2
    2
      leobject/letype.py

+ 2
- 2
leobject/letype.py Zobrazit soubor

@@ -124,10 +124,10 @@ class LeType(object):
124 124
             if not allow_internal and dname in autom_fields:
125 125
                 raise AttributeError("The field '%s' is internal"%(dname))
126 126
             if dname not in cls._fields:
127
-                raise AttributeError("No such field '%s' for %s"%(dname, self.__class__.__name__))
127
+                raise AttributeError("No such field '%s' for %s"%(dname, cls.__name__))
128 128
             cls._fieldtypes[dname].check_or_raise(dval)
129 129
         
130
-        fields = [f for f, ft in cls._fieldtypes.items() if not hasattr(ft,'internal') or not ft.internal]
130
+        fields = [f for f, ft in cls._fieldtypes.items() if not hasattr(ft,'internal') or not ft.internal and f in cls._fields]
131 131
         if complete and len(datas) < len(fields):
132 132
             raise LeObjectError("The argument complete was True but some fields are missing : %s"%(set(fields) - set(datas.keys())))
133 133
         

Loading…
Zrušit
Uložit