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()))