1. Rune Halvorsen
  2. pblight

Commits

Rune Halvorsen  committed 7c1a804

Added better type checkign for repeated fields

  • Participants
  • Parent commits 7195a81
  • Branches default

Comments (0)

Files changed (1)

File pblight.py

View file
  • Ignore whitespace
             return obj.__dict__.get(self.fieldname, self.default)
 
     def __set__(self, obj, val):
-        self.check_type(val)
+        if self.fieldtype == "repeated":
+            [self.check_type(e) for e in val]
+            # fixme: also, check for listiness? could do with a try around the comp?
+        else:
+            self.check_type(val)
+
         obj.__dict__["_setlist"].append(self.tag)
         obj.__dict__[self.fieldname] = val