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

Andreas Jung andreas at andreas-jung.com
Mon Jun 12 01:19:48 EDT 2006


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

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt	2006-06-12 05:18:55 UTC (rev 68582)
+++ Zope/branches/2.10/doc/CHANGES.txt	2006-06-12 05:19:47 UTC (rev 68583)
@@ -33,6 +33,8 @@
 
       - Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership
 
+      - Collector #1944: HTTPRequest.resolve_url has error in raising errors
+
   Zope 2.10.0 beta 1 (2006/05/30)
 
     Restructuring

Modified: Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py	2006-06-12 05:18:55 UTC (rev 68582)
+++ Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py	2006-06-12 05:19:47 UTC (rev 68583)
@@ -1042,7 +1042,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/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py	2006-06-12 05:18:55 UTC (rev 68582)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py	2006-06-12 05:19:47 UTC (rev 68583)
@@ -700,7 +700,20 @@
         self.assertEqual(f.next(),'test\n')
         f.seek(0)
         self.assertEqual(f.xreadlines(),f)
+	
+    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')
 
+
     def testDebug(self):
         TEST_ENVIRON = {
             'REQUEST_METHOD': 'GET',



More information about the Zope-Checkins mailing list