diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2013-01-08 12:30:08 -0500 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2013-01-08 12:30:45 -0500 |
commit | 1dd90ca0582757fc2090200800c8ffd92dd6fc2b (patch) | |
tree | df3f6c1b8dbc512b70053a98afd0e2f9866b2590 | |
parent | dae522f2a6b0e1e8350f29a5a276709c4404af2c (diff) | |
download | pecan-1dd90ca0582757fc2090200800c8ffd92dd6fc2b.tar.gz |
Always include ``pecan.request['extension']``.
-rw-r--r-- | pecan/core.py | 1 | ||||
-rw-r--r-- | pecan/tests/test_base.py | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/pecan/core.py b/pecan/core.py index b6c09ff..32185e5 100644 --- a/pecan/core.py +++ b/pecan/core.py @@ -368,6 +368,7 @@ class Pecan(object): # lookup the controller, respecting content-type as requested # by the file extension on the URI path = request.pecan['routing_path'] + request.pecan['extension'] = None # attempt to guess the content type based on the file extension if not request.pecan['content_type'] and '.' in path.split('/')[-1]: diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py index ba495b8..043df38 100644 --- a/pecan/tests/test_base.py +++ b/pecan/tests/test_base.py @@ -863,7 +863,7 @@ class TestFileTypeExtensions(unittest.TestCase): class RootController(object): @expose(content_type=None) def _default(self, *args): - ext = request.pecan.get('extension') + ext = request.pecan['extension'] assert len(args) == 1 if ext: assert ext not in args[0] @@ -916,7 +916,7 @@ class TestFileTypeExtensions(unittest.TestCase): @expose(content_type=None) def _default(self, *args): assert 'example:x.tiny' in args - assert 'extension' not in request.pecan + assert request.pecan['extension'] is None return 'SOME VALUE' app = TestApp(Pecan(RootController())) |