[Zope3-Users] Traversing a Tuple Field

Johan Carlsson johanc at easypublisher.com
Wed Oct 26 05:26:19 EDT 2005


Hi all,

I have a schema that defines a tuple field that holds object field
of a specific type.
Now I want to be able to traverse each object in the tuple
by using ./<field_name>/<index>.

 From the Zope3 book I've learn how to create a Traverser (by 
subclassing the ContainerTraverser) but my problem is that the first name
encountered is the field_name, but I can't return the tuple (or)
because it's a simple object not aware of location (that would be
fixable I guess, I've seen a LocationProxy somewhere).
Instead I return the context, which has the effect that the
Traverser gets called again (with the index), but I can't figure
out how to save the state, that the <field_name> has already been
traverser, so I'd know that the index should be look up on the field_name.

Are there anyway to know which part of the URL that has been traverse,
or to traverse ahead in the first call to the Traverser?

Any advice on this problem?

(I just realized that using a volatile attribute on the context might
work, but it just feels to darn un-zope3-ish)

-- 
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM



More information about the Zope3-users mailing list