[Zope-Checkins] SVN: Zope/branches/2.9/ - Collector #2037: fixed broken ACTUAL_URL for '/'

Andreas Jung andreas at andreas-jung.com
Fri Mar 24 07:52:47 EST 2006


Log message for revision 66149:
  - Collector #2037: fixed broken ACTUAL_URL for '/'
  

Changed:
  U   Zope/branches/2.9/doc/CHANGES.txt
  U   Zope/branches/2.9/lib/python/Products/SiteAccess/VirtualHostMonster.py
  U   Zope/branches/2.9/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py

-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.9/doc/CHANGES.txt	2006-03-24 12:49:32 UTC (rev 66148)
+++ Zope/branches/2.9/doc/CHANGES.txt	2006-03-24 12:52:47 UTC (rev 66149)
@@ -20,6 +20,8 @@
 
       - Missing import of NotFound in webdav.Resource.
 
+      - Collector #2037: fixed broken ACTUAL_URL for '/'
+
   Zope 2.9.1  (2006/02/25)
 
     Bugs fixed

Modified: Zope/branches/2.9/lib/python/Products/SiteAccess/VirtualHostMonster.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/SiteAccess/VirtualHostMonster.py	2006-03-24 12:49:32 UTC (rev 66148)
+++ Zope/branches/2.9/lib/python/Products/SiteAccess/VirtualHostMonster.py	2006-03-24 12:52:47 UTC (rev 66149)
@@ -193,7 +193,7 @@
                     request['VIRTUAL_URL'] = '/'.join(vup)
 
                     # new ACTUAL_URL
-                    add = request['ACTUAL_URL'].endswith('/') and '/' or ''
+                    add = (path and request['ACTUAL_URL'].endswith('/')) and '/' or ''
                     request['ACTUAL_URL'] = request['VIRTUAL_URL']+add
 
                 return

Modified: Zope/branches/2.9/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py	2006-03-24 12:49:32 UTC (rev 66148)
+++ Zope/branches/2.9/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py	2006-03-24 12:52:47 UTC (rev 66149)
@@ -59,6 +59,17 @@
         m = self.app.folder.doc.getPhysicalPath
         self.assertEqual(m(), ('', 'folder', 'doc'))
 
+    def test_actual_url(self):
+        self.app.folder.manage_addDTMLMethod('index_html', '')
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot/doc/')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/doc/')
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot/doc')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/doc')
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot/')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/')
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/') 
+
 def gen_cases():
     for vbase, ubase in (
         ('', 'http://foo'),



More information about the Zope-Checkins mailing list