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
74571a54
Commit
74571a54
authored
Feb 29, 2024
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Mar 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type: set Getter guarantees the order with just removing the duplicates.
parent
201caf82
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
7 deletions
+10
-7
product/ERP5Type/Accessor/Acquired.py
product/ERP5Type/Accessor/Acquired.py
+2
-1
product/ERP5Type/Accessor/List.py
product/ERP5Type/Accessor/List.py
+1
-1
product/ERP5Type/Accessor/Related.py
product/ERP5Type/Accessor/Related.py
+2
-1
product/ERP5Type/Accessor/RelatedValue.py
product/ERP5Type/Accessor/RelatedValue.py
+3
-2
product/ERP5Type/Accessor/Value.py
product/ERP5Type/Accessor/Value.py
+2
-2
No files found.
product/ERP5Type/Accessor/Acquired.py
View file @
74571a54
...
...
@@ -27,6 +27,7 @@ from __future__ import absolute_import
#
##############################################################################
from
collections
import
OrderedDict
from
.Base
import
func_code
,
type_definition
,
list_types
,
ATTRIBUTE_PREFIX
,
Getter
as
BaseGetter
from
Products.ERP5Type.PsycoWrapper
import
psyco
...
...
@@ -208,4 +209,4 @@ class SetGetter(ListGetter):
Gets a category value set
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
return
list
(
OrderedDict
.
fromkeys
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
product/ERP5Type/Accessor/List.py
View file @
74571a54
...
...
@@ -273,6 +273,6 @@ class SetGetter(ListGetter):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
result_list
=
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
result_list
is
not
None
:
return
list
(
set
(
result_list
))
return
list
(
OrderedDict
.
fromkeys
(
result_list
))
Tester
=
Base
.
Tester
product/ERP5Type/Accessor/Related.py
View file @
74571a54
...
...
@@ -27,6 +27,7 @@ from __future__ import absolute_import
#
##############################################################################
from
collections
import
OrderedDict
from
.Base
import
func_code
,
type_definition
,
list_types
,
ATTRIBUTE_PREFIX
,
Getter
as
BaseGetter
,
Setter
as
BaseSetter
from
Products.ERP5Type.PsycoWrapper
import
psyco
from
zLOG
import
LOG
...
...
@@ -106,4 +107,4 @@ class SetGetter(ListGetter):
Gets a category value set
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
return
list
(
OrderedDict
.
fromkeys
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
product/ERP5Type/Accessor/RelatedValue.py
View file @
74571a54
...
...
@@ -27,6 +27,7 @@ from __future__ import absolute_import
#
##############################################################################
from
collections
import
OrderedDict
from
.Base
import
func_code
,
type_definition
,
list_types
,
\
ATTRIBUTE_PREFIX
,
Getter
as
BaseGetter
,
Setter
as
BaseSetter
from
Products.ERP5Type.PsycoWrapper
import
psyco
...
...
@@ -112,7 +113,7 @@ class SetGetter(ListGetter):
Gets a category value set
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
return
list
(
set
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
return
list
(
OrderedDict
.
fromkeys
(
ListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
class
DefaultPropertyGetter
(
BaseGetter
):
...
...
@@ -192,7 +193,7 @@ class PropertySetGetter(PropertyListGetter):
Gets a category value set
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
return
list
(
set
(
PropertyListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
return
list
(
OrderedDict
.
fromkeys
(
PropertyListGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)))
class
DefaultIdGetter
(
PropertyGetter
):
...
...
product/ERP5Type/Accessor/Value.py
View file @
74571a54
...
...
@@ -232,7 +232,7 @@ class UidSetSetter(BaseSetter):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
if
self
.
_warning
:
LOG
(
"ERP5Type Deprecated Getter Id:"
,
0
,
self
.
_id
)
instance
.
_setValueUidList
(
self
.
_key
,
set
(
args
[
0
]
),
instance
.
_setValueUidList
(
self
.
_key
,
list
(
OrderedDict
.
fromkeys
(
args
[
0
])
),
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
...
...
@@ -298,4 +298,4 @@ class PropertySetGetter(PropertyListGetter):
"""
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
r
=
PropertyListGetter
.
__call__
(
self
,
instance
,
**
kw
)
return
list
(
set
(
r
))
if
r
or
not
args
else
args
[
0
]
return
list
(
OrderedDict
.
fromkeys
(
r
))
if
r
or
not
args
else
args
[
0
]
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