[Zope-Checkins] CVS: Zope2 - HTTPRequest.py:1.43.2.7
Brian Lloyd
brian@digicool.com
Tue, 27 Mar 2001 14:51:03 -0500 (EST)
Update of /cvs-repository/Zope2/lib/python/ZPublisher
In directory korak:/home/brian/temp/zope-23-branch/lib/python/ZPublisher
Modified Files:
Tag: zope-2_3-branch
HTTPRequest.py
Log Message:
cleaned up physicalPathFromURL interface
--- Updated File HTTPRequest.py in package Zope2 --
--- HTTPRequest.py 2001/03/27 14:11:39 1.43.2.6
+++ HTTPRequest.py 2001/03/27 19:51:02 1.43.2.7
@@ -248,20 +248,14 @@
def physicalPathFromURL(self, URL):
""" Convert a URL into a physical path in the current context.
-
- Returns a pair (path, flags), where flags is a three-tuple of
- 1. Whether the URL conflicts with SERVER_URL
- 2. Whether the URL conflicts with BASEPATH1
- 3. How many path elements were specified
- """
+ If the URL makes no sense in light of the current virtual
+ hosting context, a ValueError is raised."""
other = self.other
bad_server_url = 0
path = filter(None, split(URL, '/'))
- # Check the protocol://host:port against SERVER_URL
+
if find(URL, '://') >= 0:
path = path[2:]
- if URL[:len(other['SERVER_URL'])] != other['SERVER_URL']:
- bad_server_url = 1
# Check the path against BASEPATH1
vhbase = self._script
@@ -270,13 +264,11 @@
if path[:vhbl] == vhbase:
path = path[vhbl:]
else:
- bad_basepath = 1
-
- elements = len(path)
+ raise ValueError, (
+ 'Url does not match virtual hosting context'
+ )
vrpp = other.get('VirtualRootPhysicalPath', ('',))
- return list(vrpp) + map(unquote, path), (bad_server_url,
- bad_basepath,
- elements)
+ return list(vrpp) + map(unquote, path)
def _resetURLS(self):
other = self.other