Selaa lähdekoodia

Correction functions set_datas and data

prieto 8 vuotta sitten
vanhempi
commit
664a591a87
1 muutettua tiedostoa jossa 7 lisäystä ja 7 poistoa
  1. 7
    7
      lodel/leapi/leobject.py

+ 7
- 7
lodel/leapi/leobject.py Näytä tiedosto

@@ -247,10 +247,10 @@ class LeObject(object):
247 247
     # @throw NameError if name is not an existing field name
248 248
     def data(self, field_name):
249 249
         if field_name not in self._fields.keys():
250
-            raise NameError("No such field in %s : %s" % (self.__class__.__name__, name))
251
-        if not self.initialized and name not in self.__initialized:
252
-            raise RuntimeError("The field %s is not initialized yet (and have no value)" % name)
253
-        return self.__datas[name]
250
+            raise NameError("No such field in %s : %s" % (self.__class__.__name__, field_name))
251
+        if not self.initialized and field_name not in self.__initialized:
252
+            raise RuntimeError("The field %s is not initialized yet (and have no value)" % field_name)
253
+        return self.__datas[field_name]
254 254
     
255 255
     ##@brief Datas setter
256 256
     # @note for fancy data accessor use @ref LeObject.g attribute @ref LeObjectValues instance
@@ -260,9 +260,9 @@ class LeObject(object):
260 260
     # @throw NameError if fname is not valid
261 261
     # @throw AttributeError if the field is not writtable
262 262
     def set_data(self, fname, fval):
263
-        if field_name not in self.fieldnames(include_ro = False):
264
-            if field_name not in self._fields.keys():
265
-                raise NameError("No such field in %s : %s" % (self.__class__.__name__, name))
263
+        if fname not in self.fieldnames(include_ro = False):
264
+            if fname not in self._fields.keys():
265
+                raise NameError("No such field in %s : %s" % (self.__class__.__name__, fname))
266 266
             else:
267 267
                 raise AttributeError("The field %s is read only" % fname)
268 268
         self.__datas[fname] = fval

Loading…
Peruuta
Tallenna