Hi,
I have searched the lists archive and did not found
a solution to my problem.
I want to force a tree hierarchy using dtml-tree to
expand a specific branch when it is rendered the first time.
I use the following Python code borrowed from
TreeTag.py (encode_seq() ) to encode the 'id' of the tree item where I want
the tree to be opened :
from string import join, split, rfind, find,
translate
from urllib import quote, unquote
from zlib import compress,
decompress
from binascii import b2a_base64, a2b_base64
tbl=join(map(chr,
range(256)),'')
tplus=tbl[:ord('+')]+'-'+tbl[ord('+')+1:]
tminus=tbl[:ord('-')]+'+'+tbl[ord('-')+1:]
state=compress(str([id]))
l=len(state)
if l > 57:
states=[]
for i in
range(0,l,57):
states.append(b2a_base64(state[i:i+57])[:-1])
state=join(states,'')
else:
state=b2a_base64(state)[:-1]
l=find(state,'=')
if l >=
0:
state=state[:l]
state=translate(state, tplus)
return state
***********************************************
The dtml-tree that I want to manipulate is
something like :
<dtml-let id="''">
<dtml-tree id assume_children=yes id=id
branches_expr="an_external_method(PARENT=id, USER=USER)">
<dtml-var
title>
</dtml-tree>
</dtml-let>
The problem is that when I display the value
returned by this Python code for a given 'id' and compare it to the
value of 'tree-e' in the REQUEST, they don't match. And I expect them to
match.
Can someone give me some lights ? Is my
problem related to cookies or is it my encoding function that is used correctly
?
Many thanks,
Kamon
Experts-MD.com