fixed Issue 1505:Json fields imported from csv do not work with postgresql, thanks anonoofish

This commit is contained in:
mdipierro
2013-05-27 10:41:57 -05:00
parent e38cfc5767
commit d1e25796e9
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.7-stable+timestamp.2013.05.27.10.36.47
Version 2.4.7-stable+timestamp.2013.05.27.10.41.10
+9 -1
View File
@@ -2672,7 +2672,9 @@ class PostgreSQLAdapter(BaseAdapter):
elif self.driver_name == "zxJDBC":
supports_json = self.connection.dbversion >= "9.2.0"
else: supports_json = None
if supports_json: self.types["json"] = "JSON"
if supports_json:
self.types["json"] = "JSON"
self.native_json = True
else: LOGGER.debug("Your database version does not support the JSON data type (using TEXT instead)")
def LIKE(self,first,second):
@@ -8709,6 +8711,12 @@ class Table(object):
value = None
elif field.type=='blob':
value = base64.b64decode(value)
elif field.type=='json':
try:
json = serializers.json
value = json(value)
except TypeError:
pass
elif field.type=='double' or field.type=='float':
if not value.strip():
value = None