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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
b1b9451c
Commit
b1b9451c
authored
Sep 10, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not store _marker value in cache, especially for the value where loads(dumps(x)) != x.
parent
95c326f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
product/ERP5Form/PreferenceTool.py
product/ERP5Form/PreferenceTool.py
+5
-8
No files found.
product/ERP5Form/PreferenceTool.py
View file @
b1b9451c
...
@@ -66,7 +66,7 @@ class PreferenceMethod(Method):
...
@@ -66,7 +66,7 @@ class PreferenceMethod(Method):
self
.
_preference_cache_id
=
'PreferenceTool.CachingMethod.%s'
%
attribute
self
.
_preference_cache_id
=
'PreferenceTool.CachingMethod.%s'
%
attribute
def
__call__
(
self
,
instance
,
default
=
_marker
,
*
args
,
**
kw
):
def
__call__
(
self
,
instance
,
default
=
_marker
,
*
args
,
**
kw
):
def
_getPreference
(
*
args
,
**
kw
):
def
_getPreference
(
default
,
*
args
,
**
kw
):
# XXX: sql_catalog_id is passed when calling getPreferredArchive
# XXX: sql_catalog_id is passed when calling getPreferredArchive
# This is inconsistent with regular accessor API, and indicates that
# This is inconsistent with regular accessor API, and indicates that
# there is a design problem in current archive API.
# there is a design problem in current archive API.
...
@@ -78,17 +78,14 @@ class PreferenceMethod(Method):
...
@@ -78,17 +78,14 @@ class PreferenceMethod(Method):
# user to mask a non-null global value with a null value.
# user to mask a non-null global value with a null value.
if
value
not
in
(
_marker
,
None
,
''
,
(),
[]):
if
value
not
in
(
_marker
,
None
,
''
,
(),
[]):
return
value
return
value
return
_marker
if
default
is
_marker
:
return
self
.
_preference_default
return
default
_getPreference
=
CachingMethod
(
_getPreference
,
_getPreference
=
CachingMethod
(
_getPreference
,
id
=
'%s.%s'
%
(
self
.
_preference_cache_id
,
id
=
'%s.%s'
%
(
self
.
_preference_cache_id
,
getSecurityManager
().
getUser
().
getId
()),
getSecurityManager
().
getUser
().
getId
()),
cache_factory
=
'erp5_ui_short'
)
cache_factory
=
'erp5_ui_short'
)
value
=
_getPreference
(
*
args
,
**
kw
)
return
_getPreference
(
default
,
*
args
,
**
kw
)
if
value
is
not
_marker
:
return
value
elif
default
is
_marker
:
return
self
.
_preference_default
return
default
class
PreferenceTool
(
BaseTool
):
class
PreferenceTool
(
BaseTool
):
"""
"""
...
...
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