[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Traversing - __init__.py:1.14
Marius Gedminas
mgedmin@codeworks.lt
Thu, 12 Dec 2002 06:32:36 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing
In directory cvs.zope.org:/tmp/cvs-serv21266/lib/python/Zope/App/Traversing
Modified Files:
__init__.py
Log Message:
Merge named-component-configuration-branch
=== Zope3/lib/python/Zope/App/Traversing/__init__.py 1.13 => 1.14 ===
--- Zope3/lib/python/Zope/App/Traversing/__init__.py:1.13 Fri Dec 6 07:10:20 2002
+++ Zope3/lib/python/Zope/App/Traversing/__init__.py Thu Dec 12 06:32:35 2002
@@ -127,12 +127,13 @@
"""
if not location:
raise ValueError, "location must be non-empty: %s" % repr(location)
- if isinstance(location, tuple):
- t = tuple(map(unicode, location))
- elif isinstance(location, StringTypes):
+ if isinstance(location, StringTypes):
if location == u'/': # matches '/' or u'/'
return (u'',)
t = tuple(location.split(u'/'))
+ elif location.__class__ == tuple:
+ # isinstance doesn't work when tuple is security-wrapped
+ t = tuple(map(unicode, location))
else:
raise ValueError, \
"location %s must be a string or a tuple of strings." % (location,)
@@ -153,12 +154,13 @@
"""
if not location:
raise ValueError, "location must be non-empty."
- if isinstance(location, tuple):
+ if isinstance(location, StringTypes):
+ u = unicode(location)
+ elif location.__class__ == tuple:
+ # isinstance doesn't work when tuple is security-wrapped
u = u'/'.join(location)
if not u: # special case for u''
return u'/'
- elif isinstance(location, StringTypes):
- u = unicode(location)
else:
raise ValueError, \
"location %s must be a string or a tuple of strings." % (location,)