Json & decode errors. fix #494

This commit is contained in:
Ruud committed 2012-07-01 13:48:38 +02:00
1 parent b7f1d28347
commit d562559562
3 files changed
+13 -4

No files matched your search

+7 -1
View File
@@ -28,7 +28,13 @@ class JsonType(TypeDecorator):
impl = UnicodeText
def process_bind_param(self, value, dialect):
return toUnicode(json.dumps(value, cls = SetEncoder))
try:
return toUnicode(json.dumps(value, cls = SetEncoder))
except:
try:
return toUnicode(json.dumps(value, cls = SetEncoder, encoding = 'latin-1'))
except:
raise
def process_result_value(self, value, dialect):
return json.loads(value if value else '{}')