def load(self, obj): parsed = self._field_type.load(obj) if parsed not in self.values and parsed is not None: raise ParseError( "Parsed value %r not in allowed value of Enum(%r)" % (parsed, tuple(self.values))) return parsed
def load(self, obj): if not isinstance(obj, (unicode, type(None))): raise ParseError("%r not a unicode object" % obj) return obj
def load(self, obj): if not isinstance(obj, float): raise ParseError("Invalid value for Float field: %r" % obj) return float(obj)
def load(self, obj): if obj not in self.VALUE_MAP: raise ParseError("Invalid value for Boolean field: %r" % obj) return bool(obj)
def load(self, obj): if not isinstance(obj, (int, long, type(None))) or isinstance(obj, bool): raise ParseError("%r is not a valid Integer" % (obj, )) return obj
def load(self, obj): if not isinstance(obj, list): raise ParseError("%r is not a list object" % obj) return [self.field_type.load(o) for o in obj]
def load(self, obj, **kwargs): if not isinstance(obj, (float, int, long)): raise ParseError("Invalid value for Float field: %r" % obj) return float(obj)