Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
705330b5
Commit
705330b5
authored
Jun 29, 2011
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support reference to filter constraints.
parent
d1627ffc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+12
-5
No files found.
product/ERP5Type/Base.py
View file @
705330b5
...
@@ -2540,13 +2540,20 @@ class Base( CopyContainer,
...
@@ -2540,13 +2540,20 @@ class Base( CopyContainer,
"""
"""
Returns a list of constraints filtered by filt argument.
Returns a list of constraints filtered by filt argument.
"""
"""
# currently only 'id'
is
supported.
# currently only 'id'
and 'reference' are
supported.
constraints
=
self
.
constraints
constraints
=
self
.
constraints
if
filt
is
not
None
:
if
filt
is
not
None
:
if
'id'
in
filt
:
id_list
=
filt
.
get
(
'id'
,
None
)
id_list
=
filt
.
get
(
'id'
,
None
)
if
not
isinstance
(
id_list
,
(
list
,
tuple
)):
if
not
isinstance
(
id_list
,
(
list
,
tuple
)):
id_list
=
[
id_list
]
id_list
=
[
id_list
]
constraints
=
filter
(
lambda
x
:
x
.
id
in
id_list
,
constraints
)
constraints
=
filter
(
lambda
x
:
x
.
id
in
id_list
,
constraints
)
# New ZODB based constraint uses reference for identity
if
'reference'
in
filt
:
reference_list
=
filt
.
get
(
'reference'
,
None
)
if
not
isinstance
(
reference_list
,
(
list
,
tuple
)):
reference_list
=
[
reference_list
]
constraints
=
filter
(
lambda
x
:
x
.
getProperty
(
'reference'
)
in
reference_list
,
constraints
)
return
constraints
return
constraints
# Context related methods
# Context related methods
...
...
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