Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
c9c09bd3
Commit
c9c09bd3
authored
Apr 12, 2000
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #919: make expand_all play nice with branches_expr
parent
15b59136
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
lib/python/TreeDisplay/TreeTag.py
lib/python/TreeDisplay/TreeTag.py
+24
-7
No files found.
lib/python/TreeDisplay/TreeTag.py
View file @
c9c09bd3
...
...
@@ -84,8 +84,8 @@
##############################################################################
"""Rendering object hierarchies as Trees
"""
__rcs_id__
=
'$Id: TreeTag.py,v 1.4
0 2000/04/05 13:21:19
tseaver Exp $'
__version__
=
'$Revision: 1.4
0
$'
[
11
:
-
2
]
__rcs_id__
=
'$Id: TreeTag.py,v 1.4
1 2000/04/12 13:44:28
tseaver Exp $'
__version__
=
'$Revision: 1.4
1
$'
[
11
:
-
2
]
from
DocumentTemplate.DT_Util
import
*
from
DocumentTemplate.DT_String
import
String
...
...
@@ -208,7 +208,22 @@ def tpRender(self, md, section, args,
if
md
.
has_key
(
'collapse_all'
):
state
=
[
id
,[]],
elif
md
.
has_key
(
'expand_all'
):
state
=
[
id
,
tpValuesIds
(
self
,
args
[
'branches'
],
args
)],
have_arg
=
args
.
has_key
if
have_arg
(
'branches'
):
def
get_items
(
node
,
branches
=
args
[
'branches'
],
md
=
md
):
validate
=
md
.
validate
if
validate
is
None
or
not
hasattr
(
node
,
'aq_acquire'
):
items
=
getattr
(
node
,
branches
)
else
:
items
=
node
.
aq_acquire
(
branches
,
validate
,
md
)
return
items
()
elif
have_arg
(
'branches_expr'
):
def
get_items
(
node
,
branches_expr
=
args
[
'branches_expr'
],
md
=
md
):
md
.
_push
(
InstanceDict
(
node
,
md
))
items
=
branches_expr
(
md
)
md
.
_pop
()
return
items
state
=
[
id
,
tpValuesIds
(
self
,
get_items
,
args
)],
else
:
if
md
.
has_key
(
'tree-s'
):
state
=
md
[
'tree-s'
]
...
...
@@ -632,20 +647,22 @@ def tpStateLevel(state, level=0):
else
:
level
=
max
(
level
,
1
)
return
level
def
tpValuesIds
(
self
,
branche
s
,
args
,
def
tpValuesIds
(
self
,
get_item
s
,
args
,
simple_type
=
{
type
(
''
):
0
,
type
(
1
):
0
,
type
(
1.0
):
0
}.
has_key
,
):
# get_item(node) is a function that returns the subitems of node
# This should build the ids of subitems which are
# expandable (non-empty). Leaves should never be
# in the state - it will screw the colspan counting.
r
=
[]
idattr
=
args
[
'id'
]
try
:
try
:
items
=
get
attr
(
self
,
branches
)(
)
try
:
items
=
get
_items
(
self
)
except
AttributeError
:
items
=
()
for
item
in
items
:
try
:
if
get
attr
(
item
,
branches
)(
):
if
get
_items
(
item
):
if
hasattr
(
item
,
idattr
):
id
=
getattr
(
item
,
idattr
)
...
...
@@ -653,7 +670,7 @@ def tpValuesIds(self, branches, args,
elif
hasattr
(
item
,
'_p_oid'
):
id
=
oid
(
item
)
else
:
id
=
pyid
(
item
)
e
=
tpValuesIds
(
item
,
branche
s
,
args
)
e
=
tpValuesIds
(
item
,
get_item
s
,
args
)
if
e
:
id
=
[
id
,
e
]
else
:
id
=
[
id
]
r
.
append
(
id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment