[Zope3-dev] comments on Guido's diary

Jim Fulton jim@zope.com
Fri, 20 Dec 2002 09:46:30 -0500


Steve Alexander wrote:
> 
>>> Look in Zope/App/Traversing/tests/testConvenienceFunctions.py
>>> You'll find the class attributes _good_locations and _bad_locations 
>>> that have the examples of valid and invalid locations used to test 
>>> the functions that convert between formats for locations.
>>>
>>> According to this, a list is not a valid location.
>>>
>>> The empty tuple is not a valid location. Perhaps it should be. I'd 
>>> welcome discussion and suggestions from people who have read through 
>>> this unit-test.
>>
>>
>>
>> As Guido says, I'd suggest making () be valid and the equivalent of '.'
>> in Unix paths. I think that's the natural semantics. It will certainly
>> make code regular, and there's currently no way to express '.' in tuple
>> form.
> 
> 
> Here's my take on this:
> 
> The convenience functions locationAsUnicode and locationAsTuple are 
> meant to deal with locations. A location is always absolute. So, () 
> should not be valid. I think 'location' in Zope 3 means 'absolute 
> location'.
> 
> A pathAsUnicode or a pathAsTuple function would accept () to return 
> relative paths.

I find this distinction to be far too subtle.  A path is a way to
express a location. A path can be relative or absolute. You may say
that a location is always expressed as an abolute path, but I frankly don't see why
this would always be the case.

Jim


-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org