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
Levin Zimmermann
erp5
Commits
485bf7f5
Commit
485bf7f5
authored
Oct 07, 2019
by
Xiaowu Zhang
Committed by
Levin Zimmermann
Feb 03, 2023
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BusinessTemplate: Import Big File's data property as Pdata
parent
5eeff828
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+9
-0
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+3
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
485bf7f5
...
@@ -46,6 +46,7 @@ import string
...
@@ -46,6 +46,7 @@ import string
import
tempfile
import
tempfile
import
glob
import
glob
import
sys
import
sys
from
OFS.Image
import
Pdata
WORKFLOW_TYPE
=
'erp5_workflow'
WORKFLOW_TYPE
=
'erp5_workflow'
...
@@ -7262,8 +7263,14 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -7262,8 +7263,14 @@ class TestBusinessTemplate(BusinessTemplateMixin):
self
.
assertEqual
(
file_content
,
expected_file_content
)
self
.
assertEqual
(
file_content
,
expected_file_content
)
self
.
assertEqual
(
len
(
file_content
),
len
(
expected_file_content
))
self
.
assertEqual
(
len
(
file_content
),
len
(
expected_file_content
))
def
stepCheckFileisImportedAsPdata
(
self
,
sequence
=
None
,
**
kw
):
self
.
assertIsInstance
(
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplate
(
'erp5_xhtml_style'
).
_skin_item
.
_objects
[
'portal_skins/erp5_ckeditor/ckeditor/LICENSE.md'
].
data
,
Pdata
)
def
test_text_file_import_export
(
self
):
def
test_text_file_import_export
(
self
):
"""
"""
First Check if file is imported as Pdata, then check the following case:
When importing back ace.js containing a last line with whitespaces only,
When importing back ace.js containing a last line with whitespaces only,
the last line was not imported, and thus the file could never been
the last line was not imported, and thus the file could never been
downloaded completely as its really size was less than the one on the File
downloaded completely as its really size was less than the one on the File
...
@@ -7271,6 +7278,8 @@ class TestBusinessTemplate(BusinessTemplateMixin):
...
@@ -7271,6 +7278,8 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""
"""
sequence_list
=
SequenceList
()
sequence_list
=
SequenceList
()
sequence_string
=
"""
sequence_string
=
"""
CheckFileisImportedAsPdata
CreateSkinFolder
CreateSkinFolder
CreateTextFile
CreateTextFile
CheckTextFileContent
CheckTextFileContent
...
...
product/ERP5/Document/BusinessTemplate.py
View file @
485bf7f5
...
@@ -99,6 +99,7 @@ from ZODB.broken import Broken, BrokenModified
...
@@ -99,6 +99,7 @@ from ZODB.broken import Broken, BrokenModified
from
Products.ERP5.genbt5list
import
BusinessTemplateRevision
,
\
from
Products.ERP5.genbt5list
import
BusinessTemplateRevision
,
\
item_name_list
,
item_set
item_name_list
,
item_set
from
Products.ERP5Type.mixin.component
import
ComponentMixin
from
Products.ERP5Type.mixin.component
import
ComponentMixin
from
OFS.Image
import
File
as
OFSFile
CACHE_DATABASE_PATH
=
None
CACHE_DATABASE_PATH
=
None
try
:
try
:
...
@@ -878,6 +879,8 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -878,6 +879,8 @@ class ObjectTemplateItem(BaseTemplateItem):
# backward-compatibility
# backward-compatibility
elif
six
.
PY3
and
is_text
:
elif
six
.
PY3
and
is_text
:
data
=
data
.
decode
(
'utf-8'
)
data
=
data
.
decode
(
'utf-8'
)
if
isinstance
(
obj
,
OFSFile
)
and
property_name
==
"data"
:
data
=
obj
.
_read_data
(
data
)[
0
]
try
:
try
:
setattr
(
obj
,
property_name
,
data
)
setattr
(
obj
,
property_name
,
data
)
except
BrokenModified
:
except
BrokenModified
:
...
...
Levin Zimmermann
@levin.zimmermann
mentioned in merge request
nexedi/erp5!953 (closed)
·
Feb 03, 2023
mentioned in merge request
nexedi/erp5!953 (closed)
mentioned in merge request nexedi/erp5!953
Toggle commit list
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