[Zope] ExpansionTree

Jamie Heilman jamie@audible.transient.net
Wed, 30 Jul 2003 03:43:41 -0700


Pascal Samuzeau wrote:
> But first I've to changed your ZPT named et-examples/by-query in your
> example, to avoid this error:
>
> *******************************************************
> __traceback_info__: {'path': ['absolute_url'],
> 'TraversalRequestNameStack': []}
> TypeError: sequence index must be integer
> *******************************************************
>
> *******************************************************
> line 12:
>
> - tal:define="o r.object;url
> string:${o/absolute_url}/manage_workspace"
>
> + tal:define="o python:r.object;url
> string:${o/absolute_url}/manage_workspace"
> *******************************************************

That code you've patched doesn't appear in the examples I shipped.
The original line says: tal:define="o r/object;url string:...
It uses TALES path syntax, not python dot syntax.  Unless you changed
the code, you shouldn't have gotten that error.

> 1- I have Folders and content as:
>
> Members
> --MemberA
> ----FileA ( Type A )
> ----FileB ( Type B )
> --MembreB
> ----FileC ( Type A )
>
> What I need is to get a tree as:
> Root: the Type of Members/MemberA/FileA, recognize as a folder root
> Subfolder (if one exist, not in this case I think)

I don't follow this.  Draw me an ascii picture of what you want it to
look like.

> Leaves : FileA,FileC

Sounds like maybe, lambda o: o.objectValues(['Folder','Type A'])
But I'm unclear on the type of object MemberA and MemberB are.

> Root: Title of ForumA
> Subfolders: PostX (which have answers)
> Leaves: PostY (without answers)
>
> But for this I need to change in a fly the function calling in the
> setChildChooser's method.

Even if posts that have answers are a different type of object than
posts that don't have answers, its unlikely you'd need to dynamically
alter the child chooser method.  Most of time using a child chooser
function is as simple as performing various manipulations on the
results of methods from the ObjectManager API.  I suggest you
familiarize yourself with that API thoroughly.

-- 
Jamie Heilman                   http://audible.transient.net/~jamie/
"Most people wouldn't know music if it came up and bit them on the ass."
                                                        -Frank Zappa