[Zope3-checkins] CVS: Zope3/lib/python/Zope/Publisher/VFS - VFSRequest.py:1.3

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


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

Modified Files:
	VFSRequest.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/VFS/VFSRequest.py 1.2 => 1.3 ===
 
 
     def __setupPath(self):
-        path = self.get('path', '/').strip()
-
-        if path.endswith('/'):
-            path = path[:-1] # XXX Why? Not sure
-            self._endswithslash = 1
-        else:
-            self._endswithslash = 0
-        
-        clean = []
-        for item in path.split('/'):
-            if not item or 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")
 
     def __repr__(self):
         # Returns a *short* string.