コード例 #1
0
 def _deserialize(self, value, attr, data):
     try:
         return bson.ObjectId(value)
     except TypeError:
         self.fail("type")
     except bson.errors.InvalidId:
         self.fail("invalid")
コード例 #2
0
 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")
コード例 #3
0
 def to_python(self, value):
     return bson.ObjectId(value)
コード例 #4
0
 def objectid_list(value):
     """Convert a hexadecimal comma separated string to an ObjectId list."""
     return [bson.ObjectId(element) for element in str_list(value)]