Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Noah Brackenbury
erp5
Commits
d000a6f3
Commit
d000a6f3
authored
Aug 31, 2017
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CatalogTool: Extend "parent" support in getCategoryValueDictParameterDict
parent
304f3e55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+29
-3
No files found.
product/ERP5Catalog/CatalogTool.py
View file @
d000a6f3
...
...
@@ -1067,7 +1067,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
flag_list
.
append
(
'strict'
)
prefix
=
(
'_'
.
join
(
flag_list
)
+
'__'
)
if
flag_list
else
''
suffix
=
(
''
if
forward
else
'__related'
)
+
'__uid'
parent_
uid
_set
=
base_category_dict
.
pop
(
'parent'
,
None
)
parent_
document
_set
=
base_category_dict
.
pop
(
'parent'
,
None
)
base_category_uid_dict
=
{
base_category_id
:
{
document
.
getUid
()
for
document
in
document_set
}
for
base_category_id
,
document_set
in
base_category_dict
.
iteritems
()
...
...
@@ -1076,8 +1076,34 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
prefix
+
x
+
suffix
:
y
for
x
,
y
in
base_category_uid_dict
.
iteritems
()
}
if
parent_uid_set
is
not
None
:
result
[
'parent_uid'
]
=
parent_uid_set
if
parent_document_set
:
if
forward
:
if
strict_membership
:
result
[
'parent_uid'
]
=
{
document
.
getUid
()
for
document
in
parent_document_set
}
else
:
# XXX: is this intentionaly used somewhere ?
result
[
'path'
]
=
{
x
.
getPath
().
replace
(
'_'
,
r'\
_
') + '
/%
'
for x in parent_document_set
}
else:
# XXX: is this intentionaly used somewhere ?
parent_uid_set = {
document.getUid()
for document in parent_document_set
}
if not strict_membership:
for document in parent_document_set:
while True:
document = document.getParentValue()
uid = getattr(document, '
getUid
', lambda: None)()
if uid is None:
break
parent_uid_set.add(uid)
result['
uid
'] = parent_uid_set
return result
security.declarePublic('
getCategoryParameterDict
')
...
...
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