[Zope-Checkins] SVN: Zope/trunk/ - The REQUEST now contains a new entry ACTUAL_URL which contains the

Andreas Jung andreas at andreas-jung.com
Thu Dec 2 12:08:14 EST 2004


Log message for revision 28551:
        - The REQUEST now contains a new entry ACTUAL_URL which contains the
          full URL without query string as it appears within the location bar of
          the browser. The key has been added to provide a single key that is 
          available for vhosted and non-vhosted installations.
  
        - Collector #1605: VHM did not quote URLs
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Products/SiteAccess/VirtualHostMonster.py
  U   Zope/trunk/lib/python/ZPublisher/BaseRequest.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-12-01 20:34:35 UTC (rev 28550)
+++ Zope/trunk/doc/CHANGES.txt	2004-12-02 17:08:14 UTC (rev 28551)
@@ -46,6 +46,13 @@
 
     Bugs fixed
 
+      - The REQUEST now contains a new entry ACTUAL_URL which contains the
+        full URL without query string as it appears within the location bar of
+        the browser. The key has been added to provide a single key that is 
+        available for vhosted and non-vhosted installations.
+
+      - Collector #1605: VHM did not quote URLs
+
       - webdav.Resource: during COPY, manage_afterClone was called way
         too early, thus the object wasn't bound to the database and
         couldn't find a context. Changed to behave the same way as

Modified: Zope/trunk/lib/python/Products/SiteAccess/VirtualHostMonster.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteAccess/VirtualHostMonster.py	2004-12-01 20:34:35 UTC (rev 28550)
+++ Zope/trunk/lib/python/Products/SiteAccess/VirtualHostMonster.py	2004-12-02 17:08:14 UTC (rev 28551)
@@ -8,6 +8,7 @@
 from Acquisition import Implicit, aq_inner, aq_parent
 from ZPublisher import BeforeTraverse
 from zExceptions import BadRequest
+from urllib import quote
 import os
 
 from AccessRule import _swallow
@@ -185,11 +186,16 @@
                         vh_part = path.pop(0)[1:]
                     if vh_part:
                         request['VIRTUAL_URL_PARTS'] = vup = (
-                            request['SERVER_URL'], vh_part, '/'.join(path))
+                            request['SERVER_URL'], vh_part, quote('/'.join(path)))
                     else:
                         request['VIRTUAL_URL_PARTS'] = vup = (
-                            request['SERVER_URL'], '/'.join(path))
+                            request['SERVER_URL'], quote('/'.join(path)))
                     request['VIRTUAL_URL'] = '/'.join(vup)
+
+                    # new ACTUAL_URL
+                    add = request['ACTUAL_URL'].endswith('/') and '/' or ''
+                    request['ACTUAL_URL'] = request['VIRTUAL_URL']+add
+
                 return
             vh_used = 1 # Only retry once.
             # Try to apply the host map if one exists, and if no

Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py	2004-12-01 20:34:35 UTC (rev 28550)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py	2004-12-02 17:08:14 UTC (rev 28551)
@@ -189,6 +189,9 @@
         if response is None: response=self.response
         debug_mode=response.debug_mode
 
+        # remember path for later use
+        browser_path = path
+
         # Cleanup the path list
         if path[:1]=='/':  path=path[1:]
         if path[-1:]=='/': path=path[:-1]
@@ -251,6 +254,7 @@
         path.reverse()
 
         request['TraversalRequestNameStack'] = request.path = path
+        request['ACTUAL_URL'] = request['URL'] + quote(browser_path)
 
         # Set the posttraverse for duration of the traversal here
         self._post_traverse = post_traverse = []



More information about the Zope-Checkins mailing list