def coerce(self, field_type):
coercions = {
"IntField": int,
"BooleanField": bool,
"FloatField": float,
"DecimalField": decimal.Decimal,
"ObjectIdField": ObjectId
}
if sys.version_info >= (3, 0):
return coercions.get(field_type, str)
else:
return coercions.get(field_type, unicode)
评论列表
文章目录