[Zope3-dev] zope3-dev proposal on changing implicitly calling

Chris Withers chrisw@nipltd.com
Sat, 02 Aug 2003 14:26:46 +0100


Steve Alexander wrote:

>> How do you configure it?
> 
> You provide an adapter for ITraversable.
> zope/app/interfaces/traversing.py

What would a simple example of doing that look like?

> The docstring of DefaultTraversable says:
> 
>   """Traverses objects via attribute and item lookup"""
> 
> The code is pretty simple.

Cool :-)

> There's a special case in the code, marked with an XXX that I inserted 
> at about the time I made the proposal about making TALES not implicitly 
> call objects that have a __call__ attribute. This special case detects 
> if an attribute that has been traversed is a method. If it is a method, 
> then the method is called with no arguments.

Hmmm, so the default traverser:

1. looks up by attributes
2. looks up by item access
3. tries to call the end result (or the result of travesing each name?) with no 
arguments

What happens if one of the things that gets called takes more than no arguments?

cheers,

Chris