[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - Collector #1944: HTTPRequest.resolve_url has error in raising errors

Andreas Jung andreas at andreas-jung.com
Mon Jun 12 01:26:25 EDT 2006


Log message for revision 68585:
  
        - Collector #1944: HTTPRequest.resolve_url has error in raising errors
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2006-06-12 05:20:44 UTC (rev 68584)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2006-06-12 05:26:24 UTC (rev 68585)
@@ -25,6 +25,8 @@
 
       - Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership
 
+      - Collector #1944: HTTPRequest.resolve_url has error in raising errors
+
   Zope 2.8.7 (2007/05/29)
 
     Features added:

Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPRequest.py	2006-06-12 05:20:44 UTC (rev 68584)
+++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPRequest.py	2006-06-12 05:26:24 UTC (rev 68585)
@@ -1039,7 +1039,7 @@
         except: rsp.exception()
         if object is None:
             req.close()
-            raise rsp.errmsg, sys.exc_info()[1]
+            raise sys.exc_info()[0], rsp.errmsg
 
         # The traversal machinery may return a "default object"
         # like an index_html document. This is not appropriate

Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPRequest.py	2006-06-12 05:20:44 UTC (rev 68584)
+++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPRequest.py	2006-06-12 05:26:24 UTC (rev 68585)
@@ -649,6 +649,18 @@
         self.assertEquals(req.cookies['hmm'], '')
         self.assertEquals(req.cookies['baz'], 'gee')
 
+    def testResolveUrl(self):
+        # Check that ResolveUrl really raises the same error 
+        # it received from ZPublisher.BaseRequest.traverse
+        # collector entry 1944
+        from ZPublisher.HTTPRequest import HTTPRequest
+        from zExceptions import NotFound
+        env = TEST_ENVIRON.copy()
+        req = HTTPRequest(None, env, None)
+        req['PARENTS'] = ['Nobody', 'cares', 'here'] 
+        testmethod = req.resolve_url
+        self.assertRaises(NotFound, testmethod, 'http://localhost/does_not_exist')
+
 TEST_ENVIRON = {
     'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
     'REQUEST_METHOD': 'POST',



More information about the Zope-Checkins mailing list