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

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


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

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


=== Zope/lib/python/ZPublisher/HTTPRequest.py 1.82 => 1.83 ===
--- Zope/lib/python/ZPublisher/HTTPRequest.py:1.82	Tue Sep 24 17:57:39 2002
+++ Zope/lib/python/ZPublisher/HTTPRequest.py	Fri Sep 27 13:36:11 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']