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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
705b4472
Commit
705b4472
authored
Mar 20, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! OOoUtils: deprecated openFromString in favor of openFromBytes WIP
🚧
parent
2dd8b34d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
13 deletions
+15
-13
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
...emplateItem/portal_components/test.erp5.testAccounting.py
+1
-1
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.py
...plateItem/portal_skins/erp5_ooo_import/Base_importFile.py
+2
-2
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testInvoice.py
...stTemplateItem/portal_components/test.erp5.testInvoice.py
+1
-1
bt5/erp5_web/TestTemplateItem/portal_components/test.erp5.testOOoChart.py
...tTemplateItem/portal_components/test.erp5.testOOoChart.py
+2
-2
product/ERP5OOo/tests/testOOoParser.py
product/ERP5OOo/tests/testOOoParser.py
+7
-5
product/ERP5OOo/tests/testOOoStyle.py
product/ERP5OOo/tests/testOOoStyle.py
+2
-2
No files found.
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
View file @
705b4472
...
...
@@ -3387,7 +3387,7 @@ class TestAccountingExport(AccountingTestCase):
form_id
=
'AccountingTransaction_view'
)
from
Products.ERP5OOo.OOoUtils
import
OOoParser
parser
=
OOoParser
()
parser
.
openFrom
String
(
ods_data
)
parser
.
openFrom
Bytes
(
ods_data
)
content_xml
=
parser
.
oo_files
[
'content.xml'
]
# just make sure that we have the correct account name
self
.
assertEqual
(
...
...
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.py
View file @
705b4472
...
...
@@ -20,11 +20,11 @@ def getSpreadsheet(file):
tmp_ooo
.
edit
(
data
=
file
.
read
(),
content_type
=
content_type
)
tmp_ooo
.
convertToBaseFormat
()
ignored
,
import_file_content
=
tmp_ooo
.
convert
(
'ods'
)
ooo_parser
.
openFrom
String
(
str
(
import_file_content
))
ooo_parser
.
openFrom
Bytes
(
bytes
(
import_file_content
))
else
:
ooo_parser
.
openFile
(
file
)
else
:
ooo_parser
.
openFrom
String
(
file
)
ooo_parser
.
openFrom
Bytes
(
file
)
return
ooo_parser
.
getSpreadsheetsMapping
()
...
...
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testInvoice.py
View file @
705b4472
...
...
@@ -636,7 +636,7 @@ class TestInvoice(TestInvoiceMixin):
# the <draw:image> should not be present, because there's no logo
parser
=
OOoParser
()
parser
.
openFrom
String
(
odt
)
parser
.
openFrom
Bytes
(
odt
)
style_xml
=
parser
.
oo_files
[
'styles.xml'
]
self
.
assertNotIn
(
'<draw:image'
,
style_xml
)
...
...
bt5/erp5_web/TestTemplateItem/portal_components/test.erp5.testOOoChart.py
View file @
705b4472
...
...
@@ -149,7 +149,7 @@ class TestOOoChart(TestOOoChartMixin):
from
Products.ERP5OOo.OOoUtils
import
OOoParser
parser
=
OOoParser
()
parser
.
openFrom
String
(
body
)
parser
.
openFrom
Bytess
(
body
)
content_xml_view
=
parser
.
oo_files
[
'content.xml'
]
doc_view
=
etree
.
fromstring
(
content_xml_view
)
...
...
@@ -243,7 +243,7 @@ class TestOOoChart(TestOOoChartMixin):
from
Products.ERP5OOo.OOoUtils
import
OOoParser
parser
=
OOoParser
()
parser
.
openFrom
String
(
body
)
parser
.
openFrom
Bytes
(
body
)
content_xml_view
=
parser
.
oo_files
[
'content.xml'
]
doc_view
=
etree
.
fromstring
(
content_xml_view
)
...
...
product/ERP5OOo/tests/testOOoParser.py
View file @
705b4472
...
...
@@ -52,16 +52,17 @@ class TestOOoParser(unittest.TestCase):
self
.
assertEqual
(
person_mapping
[
1
],
[
'John Doe 0'
,
'John'
,
'Doe 0'
,
'john.doe0@foo.com'
])
def
test_openFrom
String
(
self
):
def
test_openFrom
Bytes
(
self
):
parser
=
OOoParser
()
parser
.
openFromString
(
open
(
makeFilePath
(
'import_data_list.ods'
),
'rb'
)
.
read
())
with
open
(
makeFilePath
(
'import_data_list.ods'
),
'rb'
)
as
f
:
parser
.
openFromBytes
(
f
.
read
())
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Person'
],
list
(
mapping
.
keys
()))
def
test_getSpreadSheetMappingStyle
(
self
):
parser
=
OOoParser
()
parser
.
openFile
(
open
(
makeFilePath
(
'import_data_list_with_style.ods'
),
'rb'
))
with
open
(
makeFilePath
(
'import_data_list_with_style.ods'
),
'rb'
)
as
f
:
parser
.
openFile
(
f
)
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Feuille1'
],
list
(
mapping
.
keys
()))
self
.
assertEqual
(
mapping
[
'Feuille1'
][
1
],
...
...
@@ -75,7 +76,8 @@ class TestOOoParser(unittest.TestCase):
def
test_getSpreadSheetMappingDataTypes
(
self
):
parser
=
OOoParser
()
parser
.
openFile
(
open
(
makeFilePath
(
'import_data_list_data_type.ods'
),
'rb'
))
with
open
(
makeFilePath
(
'import_data_list_data_type.ods'
),
'rb'
)
as
f
:
parser
.
openFile
(
f
)
mapping
=
parser
.
getSpreadsheetsMapping
()
self
.
assertEqual
([
'Feuille1'
],
list
(
mapping
.
keys
()))
self
.
assertEqual
(
mapping
[
'Feuille1'
][
0
],
...
...
product/ERP5OOo/tests/testOOoStyle.py
View file @
705b4472
...
...
@@ -454,7 +454,7 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
# Is it good to do this only for ODT ?
from
Products.ERP5OOo.OOoUtils
import
OOoParser
parser
=
OOoParser
()
parser
.
openFrom
String
(
body
)
parser
.
openFrom
Bytes
(
body
)
content_xml
=
bytes2str
(
parser
.
oo_files
[
'content.xml'
])
self
.
assertIn
(
'<Escape>&<text:line-break/>newline'
,
content_xml
)
...
...
@@ -484,7 +484,7 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
from
Products.ERP5OOo.OOoUtils
import
OOoParser
parser
=
OOoParser
()
parser
.
openFrom
String
(
body
)
parser
.
openFrom
Bytes
(
body
)
content_xml
=
bytes2str
(
parser
.
oo_files
[
'content.xml'
])
self
.
assertIn
(
message
,
content_xml
)
...
...
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