diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-06-15 01:22:49 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-06-15 01:22:49 +0000 |
| commit | 0f5bf32309f8f94c8c24f558b7fae12f05c4514c (patch) | |
| tree | f1d91a0ac126a7279360f57900d525fd5c18e7ee | |
| parent | 1216ad50c697235be1cbe9547b91140b6867c5c1 (diff) | |
| download | pyramid-0f5bf32309f8f94c8c24f558b7fae12f05c4514c.tar.gz pyramid-0f5bf32309f8f94c8c24f558b7fae12f05c4514c.tar.bz2 pyramid-0f5bf32309f8f94c8c24f558b7fae12f05c4514c.zip | |
- Make 404 responses slightly cheaper by showing
``environ["PATH_INFO"]`` on the notfound result page rather than the
fullly computed URL.
| -rw-r--r-- | CHANGES.txt | 4 | ||||
| -rw-r--r-- | repoze/bfg/router.py | 2 | ||||
| -rw-r--r-- | repoze/bfg/tests/test_router.py | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c9f3313c2..4ce3369a4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Next release Features -------- +- Make 404 responses slightly cheaper by showing + ``environ["PATH_INFO"]`` on the notfound result page rather than the + fullly computed URL. + - Move LRU cache implementation into a separate package (``repoze.lru``). diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py index 65044b6e1..07f0ca43f 100644 --- a/repoze/bfg/router.py +++ b/repoze/bfg/router.py @@ -231,7 +231,7 @@ class Router(object): ) logger and logger.debug(msg) else: - msg = request.url + msg = request.path_info environ['repoze.bfg.message'] = msg return respond(self.notfound_view(context, request), '<INotFoundView>') diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py index be4fbad59..195d1bba7 100644 --- a/repoze/bfg/tests/test_router.py +++ b/repoze/bfg/tests/test_router.py @@ -203,7 +203,7 @@ class RouterTests(unittest.TestCase): self.assertEqual(len(headers), 2) status = start_response.status self.assertEqual(status, '404 Not Found') - self.failUnless('http://localhost:8080' in result[0], result) + self.failUnless('<code>/</code>' in result[0], result) self.failIf('debug_notfound' in result[0]) self.assertEqual(len(logger.messages), 0) @@ -220,7 +220,7 @@ class RouterTests(unittest.TestCase): self.assertEqual(len(headers), 2) status = start_response.status self.assertEqual(status, '404 Not Found') - self.failUnless('http://localhost:8080' in result[0], result) + self.failUnless('<code>/</code>' in result[0], result) self.failIf('debug_notfound' in result[0]) self.assertEqual(len(logger.messages), 0) |
