From 679a7580b74c56435a2f0bef687d86000f30cf1f Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 30 Apr 2013 18:27:49 -0400 Subject: [PATCH] Fix a Py3 compatability bug in `pecan.jsonify`. --- pecan/jsonify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pecan/jsonify.py b/pecan/jsonify.py index 5bd4c0f..2d89c53 100644 --- a/pecan/jsonify.py +++ b/pecan/jsonify.py @@ -16,6 +16,7 @@ except ImportError: # pragma no cover from webob.multidict import MultiDict webob_dicts = (MultiDict,) +import six from simplegeneric import generic try: @@ -77,7 +78,7 @@ class GenericJSON(JSONEncoder): returns webob_dicts.mixed() dictionary, which is guaranteed to be JSON-friendly. ''' - if hasattr(obj, '__json__') and callable(obj.__json__): + if hasattr(obj, '__json__') and six.callable(obj.__json__): return obj.__json__() elif isinstance(obj, (date, datetime)): return str(obj)