[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - HTTPRequest.py:1.81.2.2

Martijn Pieters mj@zope.com
Fri, 27 Sep 2002 13:34:39 -0400


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv21895/lib/python/ZPublisher

Modified Files:
      Tag: Zope-2_6-branch
	HTTPRequest.py 
Log Message:
Fix setVirtualRoot in the face of unicode paths (such as occur during an XML-RPC
request.

Before anyone starts pointing at yet-another Unicode bug; this was probably
already present before Unicode changes went into Zope REQUESTs. ;)


=== Zope/lib/python/ZPublisher/HTTPRequest.py 1.81.2.1 => 1.81.2.2 ===
--- Zope/lib/python/ZPublisher/HTTPRequest.py:1.81.2.1	Wed Sep 25 12:08:11 2002
+++ Zope/lib/python/ZPublisher/HTTPRequest.py	Fri Sep 27 13:34:39 2002
@@ -14,6 +14,7 @@
 __version__='$Revision$'[11:-2]
 
 import re, sys, os,  urllib, time, random, cgi, codecs
+from types import StringType, UnicodeType
 from BaseRequest import BaseRequest
 from HTTPResponse import HTTPResponse
 from cgi import FieldStorage, escape
@@ -162,8 +163,8 @@
     def setVirtualRoot(self, path, hard=0):
         """ Treat the current publishing object as a VirtualRoot """
         other = self.other
-        if type(path) is type(''):
-            path = path.split( '/')
+        if isinstance(path, StringType) or isinstance(path, UnicodeType):
+            path = path.split('/')
         self._script[:] = map(quote, filter(None, path))
         del self._steps[:]
         parents = other['PARENTS']