I've thought about this some more and chatted with Fred. Here's what I
>> Zope2 uses them at the beginning of a path to indicate traversal from
>> the root.
> Sure, in restrictedTraverse and the like. But not in TALES expressions.
> While you can start a TALES expression on a /, the empty path element at
> the beginning stands for the global namespace. Hence, path:foo/bar and
> path:/foo/bar are identical. Specially, you still have to write root/bla
> or /root/bla to traverse from the root object.
Since /foo/bar is like foo/bar as I pointed out above, there's no use
case currently to support /foo/bar.
>> -1 to dropping that case (it is the one which makes
>> '/foo/bar' behave orthagonally). Havinng blank elements work as no-ops
>> also makes them behave predictably: this is what command shells (sane
>> ones, anyway) do with them. E.g.:
>> $ ls /path/to//foo
>> yiels the same results as:
>> $ ls /path/to/foo
>> So -0 to dropping the current blank traversal behavior at all.
>> Therefore, +0 to modifying Z3's version to allow the same behavior (I
>> think Zope2's version is more correct).
Parallels like this (traversing from root, normalizing empty elements)
sure sound nice, they don't work as expected even in Zope 2.9. The root
case has been discussed above. The empty elements case works
differently, too. foo//bar will yield the traversal elements ['foo', '',
'bar'] and you'll get a KeyError: ''. Zope 2.9 does NOT normalize like a
So, even though Chris Withers and you like the parallels to a Unix
shell, they're not even reality as of Zope 2.9. Moreover, I see no use
case for empty path elements currently. Yes, Zope 2 has a unit test that
tests them and the CMF happens to use them by mistake because it
compiles even empty filter expressions for actions. But those are no use
cases. The CMF case (it's a GenericSetup case now, I think) is just
plain misguided usage of TALES expressions. It should not even try to
compile an empty expression string.
My tendency is to fix CMF which (apart from that one unit test in Zope
2) seems to be the only place where empty path elements occur (and even
there not deliberately but accidentally).
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -