summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-05-03 11:09:06 -0400
committerChris McDonough <chrism@plope.com>2012-05-03 11:09:06 -0400
commit0ce30393a763628379d40bcfa667b3e05a433ec4 (patch)
treec512fa238ef6726d9ce9fac3ef4c58db41e5628b
parentad42cef589f37b998e804e780e92e52544ecfb16 (diff)
downloadpyramid-0ce30393a763628379d40bcfa667b3e05a433ec4.tar.gz
pyramid-0ce30393a763628379d40bcfa667b3e05a433ec4.tar.bz2
pyramid-0ce30393a763628379d40bcfa667b3e05a433ec4.zip
use the same default logic for jsonp as for json
-rw-r--r--pyramid/renderers.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/pyramid/renderers.py b/pyramid/renderers.py
index bdef6f561..701878264 100644
--- a/pyramid/renderers.py
+++ b/pyramid/renderers.py
@@ -343,12 +343,13 @@ class JSONP(JSON):
def default(obj):
if hasattr(obj, '__json__'):
return obj.__json__(request)
-
- result = self.components.queryAdapter(obj, IJSONAdapter,
- default=_marker)
- if result is not _marker:
- return result
- raise TypeError('%r is not JSON serializable' % (obj,))
+ obj_iface = providedBy(obj)
+ adapters = self.components.adapters
+ result = adapters.lookup((obj_iface,), IJSONAdapter,
+ default=_marker)
+ if result is _marker:
+ raise TypeError('%r is not JSON serializable' % (obj,))
+ return result(obj, request)
val = self.serializer(value, default=default, **self.kw)
callback = request.GET.get(self.param_name)