summaryrefslogtreecommitdiff
path: root/pecan/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'pecan/core.py')
-rw-r--r--pecan/core.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pecan/core.py b/pecan/core.py
index 14b9ad3..854d948 100644
--- a/pecan/core.py
+++ b/pecan/core.py
@@ -585,9 +585,11 @@ class PecanBase(object):
template = content_types.get(pecan_state['content_type'])
# check if for controller override of template
- template = pecan_state.get('override_template', template) or (
- 'json' if self.default_renderer == 'json' else None
- )
+ template = pecan_state.get('override_template', template)
+ if template is None and cfg['explicit_content_type'] is False:
+ if self.default_renderer == 'json':
+ template = 'json'
+
pecan_state['content_type'] = pecan_state.get(
'override_content_type',
pecan_state['content_type']
@@ -660,6 +662,10 @@ class PecanBase(object):
req = self.request_cls(environ)
resp = self.response_cls()
state = RoutingState(req, resp, self)
+ environ['pecan.locals'] = {
+ 'request': req,
+ 'response': resp
+ }
controller = None
# handle the request