[Repoze-checkins] r1103 - in repoze.zope2/trunk: . repoze/zope2 repoze/zope2/tests

Chris McDonough chrism at agendaless.com
Wed Jun 18 16:50:59 EDT 2008


Author: Chris McDonough <chrism at agendaless.com>
Date: Wed Jun 18 16:50:59 2008
New Revision: 1103

Log:
  - Properly unquote PATH_INFO segments into
    TraversalRequestNameStack.



Modified:
   repoze.zope2/trunk/CHANGES.txt
   repoze.zope2/trunk/repoze/zope2/tests/test_z2bob.py
   repoze.zope2/trunk/repoze/zope2/z2bob.py

Modified: repoze.zope2/trunk/CHANGES.txt
==============================================================================
--- repoze.zope2/trunk/CHANGES.txt	(original)
+++ repoze.zope2/trunk/CHANGES.txt	Wed Jun 18 16:50:59 2008
@@ -7,6 +7,9 @@
     accumulated_headers) were not returned in the response header
     list.
 
+  - Properly unquote PATH_INFO segments into
+    TraversalRequestNameStack.
+
 0.4.2 (2008-06-11)
 
   - Deal with Unauthorized exceptions properly: allow

Modified: repoze.zope2/trunk/repoze/zope2/tests/test_z2bob.py
==============================================================================
--- repoze.zope2/trunk/repoze/zope2/tests/test_z2bob.py	(original)
+++ repoze.zope2/trunk/repoze/zope2/tests/test_z2bob.py	Wed Jun 18 16:50:59 2008
@@ -136,6 +136,7 @@
         env = _makeEnviron()
         env['SERVER_NAME'] = 'www.example.com'
         env['SERVER_PORT'] = '80'
+        env['PATH_INFO'] = '/foo/space%20in%20name'
         helper = self._makeOne(env)
         if queryInteraction() is not None:
             endInteraction()
@@ -146,9 +147,11 @@
         self.assertNotEqual(queryInteraction(), None)
         self.assertEqual(helper.request['URL'], 'http://www.example.com')
         self.assertEqual(helper.request['ACTUAL_URL'],
-                         'http://www.example.com/foo')
+                         'http://www.example.com/foo/space%20in%20name')
         self.assertEqual(helper.default_page, 'index_html')
         self.assertEqual(helper.vroot_stack, None)
+        self.assertEqual(helper.clean, ['foo', 'space in name'])
+        self.assertEqual(helper.request.path, ['space in name', 'foo'])
 
     def test_setup_xmlrpcresponse(self):
         from zope.security.management import queryInteraction

Modified: repoze.zope2/trunk/repoze/zope2/z2bob.py
==============================================================================
--- repoze.zope2/trunk/repoze/zope2/z2bob.py	(original)
+++ repoze.zope2/trunk/repoze/zope2/z2bob.py	Wed Jun 18 16:50:59 2008
@@ -107,6 +107,7 @@
         if item in ('REQUEST', 'aq_self', 'aq_base'):
             # ZPublisher used to do NotFound, but that's wrong
             raise httpexceptions.HTTPForbidden(path)
+        item = urllib.unquote(item) # deal with spaces in path segment mainly
         if not item or item=='.':
             continue
         elif item == '..':
@@ -138,7 +139,6 @@
         self._configure(config)
         self.environ = environ
         self.request = None
-        self.db = None
         self.root = None
         self.conn = None
         self.browser_default = False


More information about the Repoze-checkins mailing list