def _deserialize(self, value, attr, data): try: return bson.ObjectId(value) except TypeError: self.fail("type") except bson.errors.InvalidId: self.fail("invalid")
def _deserialize(self, value, attr, data, **kwargs): try: return bson.ObjectId(value) except TypeError: raise self.make_error("type") except bson.objectid.InvalidId: raise self.make_error("invalid")
def to_python(self, value): return bson.ObjectId(value)
def objectid_list(value): """Convert a hexadecimal comma separated string to an ObjectId list.""" return [bson.ObjectId(element) for element in str_list(value)]