[Zope3-dev] Notations for paths (was comments on Guido's diary)

Leonardo Rochael Almeida leo@hiper.com.br
20 Dec 2002 18:48:27 -0200


On Fri, 2002-12-20 at 13:02, Jim Fulton wrote:
> Steve Alexander wrote:
> > 
> >> - It should be possible to convert between the string and sequence forms
> >>   with the simple expressions:
> >>
> >>   stringpath = '/'.join(tuplepath)
> >>
> >>   tuplepath = stringpath.split('/')
> > 
> > 
> > This is not possible in general. I've had to correct code that tries to 
> > convert between string locations and tuple locations using the simple 
> > expressions above. They do not work for the root '/' or ('',). Relying 
> > on the simple expressions caused a number of subtle and hard to track 
> > down bugs that I fixed a couple of weeks ago.
> 
> That's surprizing, because Iv't found this mechanism to be quite robost in
> the past.
> 
> 
> >  >>> root_string = '/'
> >  >>> root_tuple = ('',)
> >  >>>
> >  >>> '/'.join(root_tuple)
> > ''
> >  >>> root_string.split('/')
> > ['', '']
> >  >>> tuple(root_string.split('/'))
> > ('', '')
> 
> This is interesting. Zope 2 treats trailing slashes as optional.
> 
> Still, I'm surprised that this hasn't been more of a problem in Zope 2.

Well, there was this one...

http://collector.zope.org/Zope/235


-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.