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
Xiaowu Zhang
erp5
Commits
37e1ab36
Commit
37e1ab36
authored
Oct 07, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BusinessTemplate: Import Big File's data property as Pdata
parent
969c3e23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+3
-0
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+9
-0
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
37e1ab36
...
...
@@ -95,6 +95,7 @@ import threading
from
ZODB.broken
import
Broken
,
BrokenModified
from
Products.ERP5.genbt5list
import
BusinessTemplateRevision
,
\
item_name_list
,
item_set
from
OFS.Image
import
File
as
OFSFile
CACHE_DATABASE_PATH
=
None
try
:
...
...
@@ -898,6 +899,8 @@ class ObjectTemplateItem(BaseTemplateItem):
obj
.
__class__
.
__name__
][
1
:]
if
unicode_data
:
data
=
data
.
decode
(
obj
.
output_encoding
)
if
isinstance
(
obj
,
OFSFile
)
and
property_name
==
"data"
:
data
=
obj
.
_read_data
(
data
)[
0
]
try
:
setattr
(
obj
,
property_name
,
data
)
except
BrokenModified
:
...
...
product/ERP5/tests/testBusinessTemplate.py
View file @
37e1ab36
...
...
@@ -50,6 +50,7 @@ import string
import
tempfile
import
glob
import
sys
from
OFS.Image
import
Pdata
WORKFLOW_TYPE
=
'erp5_workflow'
...
...
@@ -7075,8 +7076,14 @@ class TestBusinessTemplate(BusinessTemplateMixin):
self
.
assertEqual
(
file_content
,
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
):
"""
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,
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
...
...
@@ -7084,6 +7091,8 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""
sequence_list
=
SequenceList
()
sequence_string
=
"""
CheckFileisImportedAsPdata
CreateSkinFolder
CreateTextFile
CheckTextFileContent
...
...
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