diff rhodecode/lib/ext_json.py @ 2817:3ae42e10b665 beta

fix ext-json extension issue when exception is raised for non-serializable objects
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 06 Sep 2012 11:32:36 +0200
parents 5c8b1eaafe77
children 83159d73b13b
line wrap: on
line diff
--- a/rhodecode/lib/ext_json.py	Thu Sep 06 00:43:44 2012 +0200
+++ b/rhodecode/lib/ext_json.py	Thu Sep 06 11:32:36 2012 +0200
@@ -92,7 +92,7 @@
                 return _obj_dump(obj)
             except NotImplementedError:
                 pass
-            return json.JSONEncoder.default(self, obj)
+            raise TypeError("%r is not JSON serializable" % (obj,))
     # monkey-patch JSON encoder to use extended version
     json.dumps = functools.partial(json.dumps, cls=ExtendedEncoder)
     json.dump = functools.partial(json.dump, cls=ExtendedEncoder)