diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2013-02-04 09:59:55 -0800 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2013-02-04 09:59:55 -0800 |
commit | 5f245a74494b93f0ec787cb59d820561cbff0d3a (patch) | |
tree | 8021697795c83d5165aa21b1b23f6cb9032a3466 | |
parent | 78b1aece2b6c0c3fbdb9fba040a3cdb245cfa08c (diff) | |
parent | 7b370adcf51445aea2e985ea564045672a505170 (diff) | |
download | pecan-5f245a74494b93f0ec787cb59d820561cbff0d3a.tar.gz |
Merge pull request #176 from alfredodeza/path_info
Fix use of path_info when handling a request
-rw-r--r-- | pecan/core.py | 5 | ||||
-rw-r--r-- | pecan/tests/test_base.py | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/pecan/core.py b/pecan/core.py index a31dd9d..3f22d79 100644 --- a/pecan/core.py +++ b/pecan/core.py @@ -363,8 +363,9 @@ class Pecan(object): # get a sorted list of hooks, by priority (no controller hooks yet) state.hooks = self.determine_hooks() - # store the routing path to allow hooks to modify it - request.pecan['routing_path'] = request.path + # store the routing path for the current application to allow hooks to + # modify it + request.pecan['routing_path'] = request.path_info # handle "on_route" hooks self.handle_hooks('on_route', state) diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py index e31e577..b5f4029 100644 --- a/pecan/tests/test_base.py +++ b/pecan/tests/test_base.py @@ -725,6 +725,23 @@ class TestAbort(unittest.TestCase): assert r.status_int == 401 +class TestSriptName(unittest.TestCase): + + def setUp(self): + self.environ = {'SCRIPT_NAME': '/foo'} + + def test_handle_script_name(self): + class RootController(object): + @expose() + def index(self): + return 'Root Index' + + app = TestApp(Pecan(RootController()), extra_environ=self.environ) + r = app.get('/foo/') + assert r.status_int == 200 + + + class TestRedirect(unittest.TestCase): @property |