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
1
Merge Requests
1
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
Cédric Le Ninivin
erp5
Commits
bd5e4c85
Commit
bd5e4c85
authored
Jul 27, 2016
by
Klaus Wölfel
Committed by
Ivan Tyagov
Sep 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve all objects in portal_callables
parent
fa172b02
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
product/ERP5Type/patches/CMFCoreSkinnable.py
product/ERP5Type/patches/CMFCoreSkinnable.py
+13
-4
product/ERP5Type/patches/CMFCoreSkinsTool.py
product/ERP5Type/patches/CMFCoreSkinsTool.py
+2
-1
No files found.
product/ERP5Type/patches/CMFCoreSkinnable.py
View file @
bd5e4c85
...
@@ -30,7 +30,7 @@ from Acquisition import aq_base
...
@@ -30,7 +30,7 @@ from Acquisition import aq_base
during the same request.
during the same request.
"""
"""
def
_initializeCache
(
skin_tool
,
skin_folder_id_list
):
def
_initializeCache
(
portal_callables
,
skin_tool
,
skin_folder_id_list
):
skin_list
=
{}
skin_list
=
{}
for
skin_folder_id
in
skin_folder_id_list
[::
-
1
]:
for
skin_folder_id
in
skin_folder_id_list
[::
-
1
]:
try
:
try
:
...
@@ -40,6 +40,9 @@ def _initializeCache(skin_tool, skin_folder_id_list):
...
@@ -40,6 +40,9 @@ def _initializeCache(skin_tool, skin_folder_id_list):
' but does not exist.'
%
skin_folder_id
)
' but does not exist.'
%
skin_folder_id
)
else
:
else
:
skin_list
.
update
(
dict
.
fromkeys
(
skin_folder
.
objectIds
(),
skin_folder_id
))
skin_list
.
update
(
dict
.
fromkeys
(
skin_folder
.
objectIds
(),
skin_folder_id
))
# update skin_list with objects in portal_callables
if
portal_callables
is
not
None
:
skin_list
.
update
(
dict
.
fromkeys
(
portal_callables
.
objectIds
(),
"portal_callables"
))
return
skin_list
return
skin_list
def
CMFCoreSkinnableSkinnableObjectManager_initializeCache
(
self
):
def
CMFCoreSkinnableSkinnableObjectManager_initializeCache
(
self
):
...
@@ -50,10 +53,13 @@ def CMFCoreSkinnableSkinnableObjectManager_initializeCache(self):
...
@@ -50,10 +53,13 @@ def CMFCoreSkinnableSkinnableObjectManager_initializeCache(self):
if
portal_skins
is
None
:
if
portal_skins
is
None
:
return
return
portal_skins
=
portal_skins
.
aq_base
portal_skins
=
portal_skins
.
aq_base
portal_callables
=
getattr
(
self
,
'portal_callables'
,
None
)
if
portal_callables
is
not
None
:
portal_callables
=
portal_callables
.
aq_base
skin_selection_mapping
=
{}
skin_selection_mapping
=
{}
for
selection_name
,
skin_folder_id_string
in
portal_skins
.
_getSelections
().
iteritems
():
for
selection_name
,
skin_folder_id_string
in
portal_skins
.
_getSelections
().
iteritems
():
skin_selection_mapping
[
selection_name
]
=
_initializeCache
(
portal_
skin
s
,
skin_selection_mapping
[
selection_name
]
=
_initializeCache
(
portal_
callable
s
,
skin_folder_id_string
.
split
(
','
))
portal_skins
,
skin_folder_id_string
.
split
(
','
))
portal_skins
.
_v_skin_location_list
=
skin_selection_mapping
portal_skins
.
_v_skin_location_list
=
skin_selection_mapping
return
skin_selection_mapping
return
skin_selection_mapping
...
@@ -79,7 +85,8 @@ def skinResolve(self, selection, name):
...
@@ -79,7 +85,8 @@ def skinResolve(self, selection, name):
if
selection
in
skin_selection_mapping
or
\
if
selection
in
skin_selection_mapping
or
\
isinstance
(
selection
,
basestring
):
isinstance
(
selection
,
basestring
):
return
return
skin_list
=
portal_skins
.
_getSelections
()[
selection
[
0
]].
split
(
','
)
skin_list
=
portal_skins
.
_getSelections
()[
selection
[
0
]].
split
(
','
)
\
+
[
'portal_callables'
]
skin_selection_mapping
[
selection
]
=
skin_list
=
_initializeCache
(
skin_selection_mapping
[
selection
]
=
skin_list
=
_initializeCache
(
portal_skins
,
skin_list
[
1
+
skin_list
.
index
(
selection
[
1
]):])
portal_skins
,
skin_list
[
1
+
skin_list
.
index
(
selection
[
1
]):])
try
:
try
:
...
@@ -88,6 +95,8 @@ def skinResolve(self, selection, name):
...
@@ -88,6 +95,8 @@ def skinResolve(self, selection, name):
return
return
reset
=
True
reset
=
True
try
:
try
:
if
skin_folder_id
==
"portal_callables"
:
return
aq_base
(
getattr
(
aq_base
(
self
.
portal_callables
),
name
))
return
aq_base
(
getattr
(
getattr
(
portal_skins
,
skin_folder_id
),
name
))
return
aq_base
(
getattr
(
getattr
(
portal_skins
,
skin_folder_id
),
name
))
except
AttributeError
:
except
AttributeError
:
if
reset
:
if
reset
:
...
...
product/ERP5Type/patches/CMFCoreSkinsTool.py
View file @
bd5e4c85
...
@@ -59,7 +59,8 @@ def CMFCoreSkinsTool__updateCacheEntry(self, container_id, object_id):
...
@@ -59,7 +59,8 @@ def CMFCoreSkinsTool__updateCacheEntry(self, container_id, object_id):
if
not
isinstance
(
selection_name
,
basestring
):
if
not
isinstance
(
selection_name
,
basestring
):
del
skin_location_list
[
selection_name
]
del
skin_location_list
[
selection_name
]
for
selection_name
,
skin_folder_id_string
in
self
.
_getSelections
().
iteritems
():
for
selection_name
,
skin_folder_id_string
in
self
.
_getSelections
().
iteritems
():
skin_folder_id_list
=
skin_folder_id_string
.
split
(
','
)
# Add portal_callables to every selection
skin_folder_id_list
=
skin_folder_id_string
.
split
(
','
)
+
[
'portal_callables'
]
if
container_id
in
skin_folder_id_list
:
if
container_id
in
skin_folder_id_list
:
skin_folder_id_list
.
reverse
()
skin_folder_id_list
.
reverse
()
this_folder_index
=
skin_folder_id_list
.
index
(
container_id
)
this_folder_index
=
skin_folder_id_list
.
index
(
container_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