Chris McDonough
2011-01-26 6ab71c68f61979891f696d68b124b378e477a76f
- ``pyramid.view.append_slash_notfound_view`` now preserves GET query
parameters across redirects.
3 files modified
13 ■■■■■ changed files
CHANGES.txt 3 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_view.py 8 ●●●●● patch | view | raw | blame | history
pyramid/view.py 2 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -8,6 +8,9 @@
  templates for the benefit of folks who cutnpaste and save to a non-UTF8
  format.
- ``pyramid.view.append_slash_notfound_view`` now preserves GET query
  parameters across redirects.
1.0b2 (2011-01-24)
==================
pyramid/tests/test_view.py
@@ -392,6 +392,14 @@
        self.assertEqual(response.status, '302 Found')
        self.assertEqual(response.location, '/abc/')
    def test_with_query_string(self):
        request = self._makeRequest(PATH_INFO='/abc', QUERY_STRING='a=1&b=2')
        context = ExceptionResponse()
        self._registerMapper(request.registry, True)
        response = self._callFUT(context, request)
        self.assertEqual(response.status, '302 Found')
        self.assertEqual(response.location, '/abc/?a=1&b=2')
class TestAppendSlashNotFoundViewFactory(BaseTest, unittest.TestCase):
    def _makeOne(self, notfound_view):
        from pyramid.view import AppendSlashNotFoundViewFactory
pyramid/view.py
@@ -481,6 +481,8 @@
            slashpath = path + '/'
            for route in mapper.get_routes():
                if route.match(slashpath) is not None:
                    if request.environ.get('QUERY_STRING'):
                        slashpath += '?' + request.environ['QUERY_STRING']
                    return HTTPFound(location=slashpath)
        return self.notfound_view(context, request)