Adapter.native_json
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.4.1-alpha.2+timestamp.2013.01.21.14.05.02
|
||||
Version 2.4.1-alpha.2+timestamp.2013.01.21.14.12.24
|
||||
|
||||
@@ -612,6 +612,7 @@ class ConnectionPool(object):
|
||||
###################################################################################
|
||||
|
||||
class BaseAdapter(ConnectionPool):
|
||||
native_json = False
|
||||
driver = None
|
||||
driver_name = None
|
||||
drivers = () # list of drivers from which to pick
|
||||
@@ -1790,6 +1791,7 @@ class BaseAdapter(ConnectionPool):
|
||||
else:
|
||||
obj = str(obj)
|
||||
elif fieldtype == 'json':
|
||||
if not self.native_json:
|
||||
if have_serializers:
|
||||
obj = serializers.json(obj)
|
||||
elif simplejson:
|
||||
@@ -1928,6 +1930,7 @@ class BaseAdapter(ConnectionPool):
|
||||
return float(value)
|
||||
|
||||
def parse_json(self, value, field_type):
|
||||
if not self.native_json:
|
||||
if not isinstance(value, basestring):
|
||||
raise RuntimeError('json data not a string')
|
||||
if isinstance(value, unicode):
|
||||
@@ -4959,6 +4962,7 @@ def cleanup(text):
|
||||
return text
|
||||
|
||||
class MongoDBAdapter(NoSQLAdapter):
|
||||
native_json = True
|
||||
drivers = ('pymongo',)
|
||||
|
||||
uploads_in_blob = True
|
||||
|
||||
Reference in New Issue
Block a user