jsonalchemy: fix a case when default is not set and parsinge exception happens.

before: default could be undefined and raised an error.
This commit is contained in:
Marcin Kuzminski 2017-11-26 17:17:50 +01:00
parent bc23ad316c
commit b6f2cdd95b

View file

@ -83,7 +83,7 @@ class JSONEncodedObj(sqlalchemy.types.TypeDecorator):
try:
value = json.loads(value, object_pairs_hook=DictClass)
except Exception as e:
if self.safe:
if self.safe and self.default is not None:
return self.default()
else:
raise