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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
erp5
Commits
9c08d7e4
Commit
9c08d7e4
authored
Dec 22, 2014
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XMLMatrix: update _checkConsistency to handle unpreserved coordinate orders
parent
46ed69c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
product/ERP5Type/XMLMatrix.py
product/ERP5Type/XMLMatrix.py
+1
-1
product/ERP5Type/tests/testXMLMatrix.py
product/ERP5Type/tests/testXMLMatrix.py
+34
-1
No files found.
product/ERP5Type/XMLMatrix.py
View file @
9c08d7e4
...
@@ -567,7 +567,7 @@ class XMLMatrix(Folder):
...
@@ -567,7 +567,7 @@ class XMLMatrix(Folder):
to_delete_set
.
add
(
object_id
)
to_delete_set
.
add
(
object_id
)
else
:
else
:
for
i
,
coordinate
in
enumerate
(
cell_coordinate_list
):
for
i
,
coordinate
in
enumerate
(
cell_coordinate_list
):
if
coordinate
>=
len
(
base_item
[
i
]
):
if
coordinate
not
in
base_item
[
i
].
values
(
):
addError
(
"Cell %s is out of bound"
%
object_id
)
addError
(
"Cell %s is out of bound"
%
object_id
)
to_delete_set
.
add
(
object_id
)
to_delete_set
.
add
(
object_id
)
break
break
...
...
product/ERP5Type/tests/testXMLMatrix.py
View file @
9c08d7e4
...
@@ -33,6 +33,7 @@ from Testing import ZopeTestCase
...
@@ -33,6 +33,7 @@ from Testing import ZopeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Products.ERP5Type.Utils
import
cartesianProduct
from
Products.ERP5Type.Utils
import
cartesianProduct
from
Products.ERP5Type.XMLMatrix
import
XMLMatrix
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
zLOG
import
PROBLEM
from
zLOG
import
PROBLEM
...
@@ -378,7 +379,6 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -378,7 +379,6 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
self
.
assertEqual
(
cell
,
self
.
assertEqual
(
cell
,
self
.
portal
.
portal_catalog
.
getObject
(
cell
.
getUid
()))
self
.
portal
.
portal_catalog
.
getObject
(
cell
.
getUid
()))
def
test_decrease_and_increase_dimension
(
self
):
def
test_decrease_and_increase_dimension
(
self
):
matrix
=
self
.
matrix
matrix
=
self
.
matrix
...
@@ -433,6 +433,39 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -433,6 +433,39 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
self
.
assertEqual
(
cell
,
self
.
assertEqual
(
cell
,
self
.
portal
.
portal_catalog
.
getObject
(
cell
.
getUid
()))
self
.
portal
.
portal_catalog
.
getObject
(
cell
.
getUid
()))
def
test_change_dimension_and_check_consistency
(
self
):
# make sure _checkConsistency does not complain about a cell
# having an id outside the len of the dimension after a dimension
# change if id is within acceptable values
matrix
=
self
.
matrix
cell_range
=
[[
'1'
,
'2'
,],
[
'a'
,
'b'
,]]
kwd
=
{
'base_id'
:
'quantity'
}
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
for
place
in
cartesianProduct
(
cell_range
):
matrix
.
newCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
'2'
,
'b'
,
**
kwd
)
self
.
assertEqual
(
'quantity_1_1'
,
cell
.
getId
())
cell
.
setTitle
(
'This one'
)
self
.
tic
()
cell_range
=
[[
'2'
,
],
[
'b'
,]]
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
commit
()
self
.
assertEquals
(
set
([
"quantity_1_1"
]),
set
([
x
.
getId
()
for
x
in
matrix
.
objectValues
()]))
cell
=
matrix
.
getCell
(
'2'
,
'b'
,
**
kwd
)
self
.
assertEqual
(
'quantity_1_1'
,
cell
.
getId
())
self
.
assertEqual
(
'This one'
,
cell
.
getTitle
())
self
.
assertEqual
(
XMLMatrix
.
_checkConsistency
(
matrix
),
[])
cell
.
setId
(
'quantity_2_1'
)
error_list
=
XMLMatrix
.
_checkConsistency
(
matrix
)
self
.
assertEqual
(
1
,
len
(
error_list
))
self
.
assertTrue
(
error_list
[
0
][
3
].
find
(
"is out of bound"
)
>
0
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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