[Zope3-checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - HTTPRequest.py:1.7 HTTPResponse.py:1.6

Jeremy Hylton jeremy@zope.com
Wed, 17 Jul 2002 18:54:53 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/HTTP
In directory cvs.zope.org:/tmp/cvs-serv1057/Zope/Publisher/HTTP

Modified Files:
	HTTPRequest.py HTTPResponse.py 
Log Message:
Refactor __setupPath().

HTTPRequest and VFSRequest had almost identical methods, so move the
duplicate code up into the base class.  Both version s had the same
bug: Raising an exception that was not defined.  XXX Fixed this by
replacing with reference to Zope.Exceptions.NotFoundError.

XXX Also remove test of _streaming, since it isn't defined.


=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.6 => 1.7 ===
 from types import StringType
 
 from Zope.Publisher.BaseRequest import BaseRequest
+from Zope.Exceptions import NotFoundError
 
 from HTTPResponse import HTTPResponse
 from IHTTPCredentials import IHTTPCredentials
@@ -267,34 +268,7 @@
         self._cookies = cookies
 
     def __setupPath(self):
-
-        path = self.get('PATH_INFO', '/').strip()
-
-        if path.endswith('/'):
-            path = path[:-1] # XXX Why? Not sure
-            self._endswithslash = 1
-        else:
-            self._endswithslash = 0
-        
-        if path.startswith('/'):
-            path = path[1:] # XXX Why? Not sure
-
-        clean = []
-        if path:
-            for item in path.split('/'):
-                if item == '.':
-                    continue
-                elif item == '..':
-                    try: del clean[-1]
-                    except IndexError:
-                        raise NotFound('..')
-                else: clean.append(item)
-
-        clean.reverse()
-        self.setTraversalStack(clean)
-
-        self._path_suffix = None
-
+        self._setupPath_helper("PATH_INFO")
 
     ######################################
     # from: Zope.Publisher.IPublisherRequest.IPublisherRequest


=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPResponse.py 1.5 => 1.6 ===
         after beginning stream-oriented output. 
 
         """
-        if streaming:
-            self._streaming = 1
         self.output(string)
 
     #