summaryrefslogtreecommitdiff
path: root/pecan/decorators.py
diff options
context:
space:
mode:
authorRyan Petrello <lists@ryanpetrello.com>2015-06-25 11:48:49 -0400
committerRyan Petrello <lists@ryanpetrello.com>2015-06-25 11:50:09 -0400
commit1fe3cec7466655a1f7ba636f53af796c6c132f47 (patch)
tree78e5ab6646944b828cf416af746d484487ede8e9 /pecan/decorators.py
parent0001a9d94da76545991afbfb5274e8b8bacac888 (diff)
downloadpecan-1fe3cec7466655a1f7ba636f53af796c6c132f47.tar.gz
Fix a bug in the way `default_renderer` is applied.
When an explicit `content_type` is specified to `pecan.expose()`, it should always take precendece over the `default_renderer` specified at the application level. Fixes-bug: #1465688 Change-Id: I633777a3d682f17b7f61cbe691c6e93f2ce2a310
Diffstat (limited to 'pecan/decorators.py')
-rw-r--r--pecan/decorators.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pecan/decorators.py b/pecan/decorators.py
index 68195a9..15808d4 100644
--- a/pecan/decorators.py
+++ b/pecan/decorators.py
@@ -23,9 +23,9 @@ def when_for(controller):
def expose(template=None,
- content_type='text/html',
generic=False,
- route=None):
+ route=None,
+ **kw):
'''
Decorator used to flag controller methods as being "exposed" for
@@ -46,6 +46,8 @@ def expose(template=None,
wanted to route a function to `some-special-path'.
'''
+ content_type = kw.get('content_type', 'text/html')
+
if template == 'json':
content_type = 'application/json'
@@ -54,6 +56,7 @@ def expose(template=None,
f.exposed = True
cfg = _cfg(f)
+ cfg['explicit_content_type'] = 'content_type' in kw
if route:
# This import is here to avoid a circular import issue