[Zope3-Users] Re: Navigating between containers (sort of basic ZPT question).

Philipp von Weitershausen philipp at weitershausen.de
Mon Nov 15 11:08:18 EST 2004


Luca Manini wrote:
> Hi all.
> 
> I'm quite new to Zope, my question is probably really 'basic'. I
> apologize if this is not the right ML to post to (just tell me a
> better one), but I'm interested in Zope 3 ONLY and this seems to be
> the only ML devoted to it.

No, there's recently been opened the zope3-users at zope.org list. I'm 
CC-ing this list instead.

> I've read the wonderfull ProgrammerTutorial (from Jim Fulton) [1] and
> the Zope-3-for-Zope-2-developers doc. I've also done my home work with
> buddydemo. Nevertheless ... my problem is:
> 
> 1) I've two content classes (User, Group) and corresponding
>    constrained containers (UserFolder, GroupFolder).
> 
> 2) I've working 'listing' views for both.
> 
> 3) I want to be able to jump from one list to the other, for example:
>    having the 'gid' cell of a user's row being a href to the
>    corresponding Group view (like ..../users/staff), or to a filtered
>    list of other users in that group.
> 
> I have not found any example of this (very basic and common)
> operation: it took me ages to find oput about the @@absolute_url view.
> The 'mechanics' I need to learn to do is:
> 
> 1) managing paths (like getting absolute_url of a context and
>    splitting joining it);

If you want to do extensive URL algebra, use urllib from Python. I 
haven't found that to be necessary in ZPT though. You can usually manage 
around by using TALES and the @@absolute_url view on objects.

> 2) be able to get a container from 'a know location' (may be something
>    like site_root/users) or from acquisition (the first - or topmost -
>    container with some interface abowe the current user).

Use zapi.getParents.

> 3) how to get (from Python code) an object from an URL.

Use zapi.traverse.

Philipp


More information about the Zope3-users mailing list