Rendering object hierarchies as Trees
Imported modules
|
|
from DocumentTemplate.DT_String import String
from DocumentTemplate.DT_Util import *
from binascii import b2a_base64, a2b_base64
from string import join, split, rfind, find, translate
from urllib import quote, unquote
from zlib import compress, decompress
|
Functions
|
|
apply_diff
decode_seq
encode_seq
encode_str
oid
tpRender
tpRenderTABLE
tpStateLevel
tpValuesIds
|
|
apply_diff
|
apply_diff (
state,
diff,
expand,
)
|
|
decode_seq
|
decode_seq ( state )
Convert an encoded string to a sequence
|
|
encode_seq
|
encode_seq ( state )
Convert a sequence to an encoded string
|
|
encode_str
|
encode_str ( state )
Convert a sequence to an encoded string
|
|
oid
|
oid ( self )
|
|
tpRender
|
tpRender (
self,
md,
section,
args,
simple_type={ type( '' ) : 0, type( 1 ) : 0, type( 1.0 ) : 0 },
)
Render data organized as a tree.
We keep track of open nodes using a cookie. The cookie stored the
tree state. State should be a tree represented like:
[] # all closed
['eagle'], # eagle is open
['eagle'], ['jeep', [1983, 1985]] # eagle, jeep, 1983 jeep and 1985 jeep
where the items are object ids. The state will be converted to a
compressed and base64ed string that gets unencoded, uncompressed,
and evaluated on the other side.
Note that ids used in state need not be connected to urls, since
state manipulation is internal to rendering logic.
Note that to make eval safe, we do not allow the character * in
the state.
|
|
tpRenderTABLE
|
tpRenderTABLE (
self,
id,
root_url,
url,
state,
substate,
diff,
data,
colspan,
section,
md,
treeData,
level=0,
args=None,
simple_type={ type( '' ) : 0, type( 1 ) : 0, type( 1.0 ) : 0 },
)
Render a tree as a table
|
|
tpStateLevel
|
tpStateLevel ( state, level=0 )
|
|
tpValuesIds
|
tpValuesIds (
self,
get_items,
args,
simple_type={ type( '' ) : 0, type( 1 ) : 0, type( 1.0 ) : 0 },
)
|
Classes
|
|
|
|