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
Joshua
erp5
Commits
4bd5cbe7
Commit
4bd5cbe7
authored
Mar 28, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preferences: support multi valuated properties
/reviewed-on
nexedi/erp5!852
parent
5709d731
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
product/ERP5Form/Document/PreferenceToolType.py
product/ERP5Form/Document/PreferenceToolType.py
+1
-1
product/ERP5Form/tests/testPreferences.py
product/ERP5Form/tests/testPreferences.py
+19
-0
No files found.
product/ERP5Form/Document/PreferenceToolType.py
View file @
4bd5cbe7
...
@@ -74,7 +74,7 @@ def _generatePreferenceToolAccessorHolder(portal_type_name,
...
@@ -74,7 +74,7 @@ def _generatePreferenceToolAccessorHolder(portal_type_name,
attr_list
=
[
'get%s'
%
convertToUpperCase
(
attribute
)]
attr_list
=
[
'get%s'
%
convertToUpperCase
(
attribute
)]
if
prop
[
'type'
]
==
'boolean'
:
if
prop
[
'type'
]
==
'boolean'
:
attr_list
.
append
(
'is%s'
%
convertToUpperCase
(
attribute
))
attr_list
.
append
(
'is%s'
%
convertToUpperCase
(
attribute
))
if
prop
[
'type'
]
in
list_types
:
if
prop
[
'type'
]
in
list_types
or
prop
[
'multivalued'
]
:
attr_list
.
append
(
'get%sList'
%
convertToUpperCase
(
attribute
))
attr_list
.
append
(
'get%sList'
%
convertToUpperCase
(
attribute
))
read_permission
=
prop
.
get
(
'read_permission'
)
read_permission
=
prop
.
get
(
'read_permission'
)
for
attribute_name
in
attr_list
:
for
attribute_name
in
attr_list
:
...
...
product/ERP5Form/tests/testPreferences.py
View file @
4bd5cbe7
...
@@ -578,6 +578,25 @@ class TestPreferences(PropertySheetTestCase):
...
@@ -578,6 +578,25 @@ class TestPreferences(PropertySheetTestCase):
self
.
assertTrue
(
portal_preferences
.
getDummy
())
self
.
assertTrue
(
portal_preferences
.
getDummy
())
self
.
assertTrue
(
portal_preferences
.
isDummy
())
self
.
assertTrue
(
portal_preferences
.
isDummy
())
def
test_multivalued_accessor
(
self
):
self
.
_addProperty
(
'Preference'
,
'test_multivaluated_accessor Preference'
,
portal_type
=
'Standard Property'
,
property_id
=
'dummy_multi'
,
preference
=
True
,
elementary_type
=
'string'
,
multivalued
=
True
)
portal_preferences
=
self
.
portal
.
portal_preferences
self
.
assertEqual
(
None
,
portal_preferences
.
getDummyMulti
())
preference
=
portal_preferences
.
newContent
(
portal_type
=
'Preference'
)
preference
.
setDummyMultiList
([
'one'
,
'two'
])
preference
.
enable
()
self
.
tic
()
self
.
assertEqual
(
'one'
,
portal_preferences
.
getDummyMulti
())
self
.
assertEqual
([
'one'
,
'two'
],
portal_preferences
.
getDummyMultiList
())
def
test_property_sheet_security_on_permission
(
self
):
def
test_property_sheet_security_on_permission
(
self
):
""" Added a test to make sure permissions are used into portal
""" Added a test to make sure permissions are used into portal
preference level. """
preference level. """
...
...
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