[Zope-dev] Subpath traversal interface (was RE: ANN: Python Methods 0.1.7
up and over to DC)
up and over to DC)
Phillip J. Eby
pje@telecommunity.com
Tue, 14 Dec 1999 11:08:51 -0500
At 11:01 AM 12/14/99 -0500, Michel Pelletier wrote:
>
>
>> -----Original Message-----
>> From: Evan Simpson [mailto:evan@4-am.com]
>>
>> I was a bit uncomfortable with both of these. In the case of
>> "traverse_subpath", it wasn't clear to me how to decide
>> whether to allow (and
>> capture) direct traversal otherwise. I couldn't use property
>> settings, since
>> PMs don't have those, and I was reluctant to simply leave
>> traversal always
>> turned on. "special_formats" is sheer laziness on my part,
>> since the dict
>> was sitting there, ripe to be popped into the namespace, and
>> with invalid
>> identifiers for keys.
>
>I think the desire we're trying to solve here is comming up with an
>interface, but to what, or at what level that interface should exist, is
>the nut of the problem.
It seems to me that what is wanted is a "traversable object", rather than a
traversable method. That is, at least for the places where I've wanted to
use such a thing, I wanted to be able to define a "__bobo_traverse__" with
a PythonMethod. But then, I don't want the whole path from there either, I
just want to be able to get the next element. In any case, it seems to me
that the best way to do this is create a Traversable base class that can be
used in ZClasses, that defers __bobo_traverse__ to a method name
ZopeTraverse or some such. Then that method can be implemented in the
ZClass however it is desired, whether by a PythonMethod, DTML method, or
even an SQL method, if appropriate.
IMHO, this doesn't belong in PythonMethods at all. (But then, I don't know
what the contributor was using it for, so perhaps some input there would be
useful.)