Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Eteri
erp5
Commits
5e2b3bbd
Commit
5e2b3bbd
authored
1 year ago
by
Yusei Tahara
Browse files
Options
Download
Email Patches
Plain Diff
Reduce rare AttributeError on Skins Tool.
Thanks to Vincent Pelletier for his help on this bug fix.
parent
e274b020
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
product/ERP5Type/patches/CMFCoreSkinnable.py
product/ERP5Type/patches/CMFCoreSkinnable.py
+10
-2
No files found.
product/ERP5Type/patches/CMFCoreSkinnable.py
View file @
5e2b3bbd
...
...
@@ -20,6 +20,7 @@ from _thread import get_ident
from
zLOG
import
LOG
,
WARNING
,
DEBUG
from
Acquisition
import
aq_base
import
six
import
random
"""
This patch modifies the way CMF Portal Skins gets a skin by its name from
...
...
@@ -148,7 +149,12 @@ def CMFCoreSkinnableSkinnableObjectManager_changeSkin(self, skinname, REQUEST=No
skinname
=
sf
.
getDefaultSkin
()
tid
=
get_ident
()
SKINDATA
[
tid
]
=
(
None
,
# CMFCore uses the first item of this tuple, but ERP5 did not.
# Thus we put a random value here to reduce rare AttributeError
# caused by wrong SKINDATA deletion. See SkinDataCleanup.hashSkinData.
# However, it is not enough. To eliminate rare AttributeError bug,
# we have to stop using global SKINDATA dict completely.
random
.
getrandbits
(
24
),
skinname
,
{
'portal_skins'
:
None
,
'portal_callables'
:
None
},
{})
...
...
@@ -207,5 +213,7 @@ class SkinDataCleanup:
pass
def
hashSkinData
(
self
,
skindata
):
return
id
(
skindata
)
# id() might return the same value even though object is different.
# thus use a random value additionally.
return
(
id
(
skindata
),
skindata
[
0
])
This diff is collapsed.
Click to expand it.
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