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
9eee056a
Commit
9eee056a
authored
Jan 11, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix _set*UidSet accessors
parent
6e6dbb01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
20 deletions
+10
-20
product/ERP5Type/Accessor/Value.py
product/ERP5Type/Accessor/Value.py
+2
-3
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+2
-5
product/ERP5Type/tests/testERP5Type.py
product/ERP5Type/tests/testERP5Type.py
+6
-12
No files found.
product/ERP5Type/Accessor/Value.py
View file @
9eee056a
...
...
@@ -48,8 +48,7 @@ class SetSetter(BaseSetter):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
if
self
.
_warning
:
LOG
(
"ERP5Type Deprecated Setter Id:"
,
0
,
self
.
_id
)
value
=
set
(
args
[
0
])
instance
.
_setValue
(
self
.
_key
,
value
,
instance
.
_setValue
(
self
.
_key
,
set
(
args
[
0
]),
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
...
...
@@ -451,7 +450,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
,
args
[
0
]
,
instance
.
_setValueUidList
(
self
.
_key
,
set
(
args
[
0
])
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
...
...
product/ERP5Type/Base.py
View file @
9eee056a
...
...
@@ -2013,11 +2013,8 @@ class Base( CopyContainer,
checked_permission
=
None
):
# We must do an ordered list so we can not use the previous method
# self._setValue(id, self.portal_catalog.getObjectList(uids), spec=spec)
references
=
[]
if
type
(
uids
)
not
in
(
type
(()),
type
([])):
uids
=
[
uids
]
for
uid
in
uids
:
references
.
append
(
self
.
portal_catalog
.
getObject
(
uid
))
references
=
map
(
self
.
getPortalObject
().
portal_catalog
.
getObject
,
(
uids
,)
if
isinstance
(
uids
,
(
int
,
long
))
else
uids
)
self
.
_setValue
(
id
,
references
,
spec
=
spec
,
filter
=
filter
,
portal_type
=
portal_type
,
keep_default
=
keep_default
,
checked_permission
=
checked_permission
)
...
...
product/ERP5Type/tests/testERP5Type.py
View file @
9eee056a
...
...
@@ -722,27 +722,21 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self
.
assertEquals
(
person
.
getDefaultRegion
(),
'alpha'
)
person
.
setRegionUid
(
alpha
.
getUid
())
self
.
assertEquals
(
person
.
getRegion
(),
'alpha'
)
person
.
setRegionUidList
([
alpha
.
getUid
(),
alph
a
.
getUid
()])
self
.
assertEquals
(
person
.
getRegionList
(),
[
'
alpha'
,
'alph
a'
])
person
.
setRegionUidList
([
beta
.
getUid
(),
bet
a
.
getUid
()])
self
.
assertEquals
(
person
.
getRegionList
(),
[
'
beta'
,
'bet
a'
])
person
.
setRegionUidSet
([
alpha
.
getUid
(),
alpha
.
getUid
()])
self
.
assertEquals
(
person
.
getRegion
Se
t
(),
[
'alpha'
])
self
.
assertEquals
(
person
.
getRegion
Lis
t
(),
[
'alpha'
])
person
.
setRegionUidList
([
alpha
.
getUid
(),
beta
.
getUid
(),
alpha
.
getUid
()])
self
.
assertEquals
(
person
.
getRegionList
(),
[
'alpha'
,
'beta'
,
'alpha'
])
person
.
setRegionUidSet
([
alpha
.
getUid
(),
beta
.
getUid
(),
alpha
.
getUid
()])
result
=
person
.
getRegionSet
()
result
.
sort
()
self
.
assertEquals
(
result
,
[
'alpha'
,
'beta'
])
self
.
assertEquals
(
sorted
(
person
.
getRegionSet
()),
[
'alpha'
,
'beta'
])
person
.
setDefaultRegionUid
(
beta
.
getUid
())
self
.
assertEquals
(
person
.
getDefaultRegion
(),
'beta'
)
result
=
person
.
getRegionSet
()
result
.
sort
()
self
.
assertEquals
(
result
,
[
'alpha'
,
'beta'
])
self
.
assertEquals
(
sorted
(
person
.
getRegionSet
()),
[
'alpha'
,
'beta'
])
self
.
assertEquals
(
person
.
getRegionList
(),
[
'beta'
,
'alpha'
])
person
.
setDefaultRegionUid
(
alpha
.
getUid
())
self
.
assertEquals
(
person
.
getDefaultRegion
(),
'alpha'
)
result
=
person
.
getRegionSet
()
result
.
sort
()
self
.
assertEquals
(
result
,
[
'alpha'
,
'beta'
])
self
.
assertEquals
(
sorted
(
person
.
getRegionSet
()),
[
'alpha'
,
'beta'
])
self
.
assertEquals
(
person
.
getRegionList
(),
[
'alpha'
,
'beta'
])
# Test accessor on documents rather than on categories
person
.
setDefaultRegionUid
(
person
.
getUid
())
...
...
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