Commits

Rune Halvorsen  committed adb99e0

Enabled type checking on __set__

  • Participants
  • Parent commits aba90fc

Comments (0)

Files changed (1)

             return obj.__dict__.get(self.fieldname, self.default)
 
     def __set__(self, obj, val):
+        self.check_type(val)
         obj.__dict__["_setlist"].append(self.tag)
         obj.__dict__[self.fieldname] = val
 
     def to_wiretype(self, value):
         return struct.pack("<I", value)
 
-#Why does the type checker not run when parsing?
-#    def check_type(self, value):
- #       print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
 
 class SFixed32Field(FixedField):
     wiretype = 5
     def from_wiretype(self, data):
         return data.decode("utf-8")
 
-    def check_type(self,data):
+    def check_type(self, data):
         if not isinstance(data, unicode):
             raise TypeError()