Fix long fields stored as int32 in Python 3. issue #1253
This commit is contained in:
@@ -19,7 +19,7 @@ else:
|
||||
|
||||
import pymongo
|
||||
import gridfs
|
||||
from bson import Binary, DBRef, SON, ObjectId
|
||||
from bson import Binary, DBRef, SON, ObjectId, Int64
|
||||
|
||||
from mongoengine.errors import ValidationError
|
||||
from mongoengine.python_support import (PY3, bin_type, txt_type,
|
||||
@@ -227,6 +227,9 @@ class LongField(BaseField):
|
||||
pass
|
||||
return value
|
||||
|
||||
def to_mongo(self, value, **kwargs):
|
||||
return Int64(value)
|
||||
|
||||
def validate(self, value):
|
||||
try:
|
||||
value = long(value)
|
||||
|
||||
Reference in New Issue
Block a user