[Zope3-dev] comments on Guido's diary
Jim Fulton
jim@zope.com
Fri, 13 Dec 2002 16:56:01 -0500
Florent Guillaume wrote:
> In article <3DF49FE9.4060101@cat-box.net> you write:
>
>> > Subproblem one: how to find this content object, given the
>> > Registration Utility object itself. Several suggestions from SteveA:
>> > get the location (a tuple of strings) and look for '++etc++Services',
>> > or at least an item starting with '++etc++';
>>
>>After checking with Jim, I can confirm that looking for
>>'++etc++Services' is the best thing to do here.
>>
>
> How about using lowercase here BTW? Do we really need a cap?
> ++etc++services looks a bit better to me.
I like this.
and I suggest changing ++etc++AppliocationControl to
++etc++process, since this is really a about management of
the process and process-level facilities.
>
>
>> > A bit about locations: there are several different ways to represent a
>> > location, and in general functions/methods that take a location accept
>> > them all. One form is a unicode string containing slashes for
>> > separators; a leading slash means an absolute path. Another form is a
>> > sequence of unicode strings that don't contain slashes; a leading
>> > empty string means an absolute path. The root is represented by ['']
>> > or ('',); an empty list or tuple is not a path (I guess it means an
>> > empty relative path :-).
>>
>>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.
I don't like this for two reasons:
- It adds yet another way to do it, which is unpythonic. :)
- It should be possible to convert between the string and sequence forms
with the simple expressions:
stringpath = '/'.join(tuplepath)
tuplepath = stringpath.split('/')
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