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
8aea5b39
Commit
8aea5b39
authored
Jun 02, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
File: clean up _setData
parent
403aba39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
product/ERP5/Document/File.py
product/ERP5/Document/File.py
+4
-13
No files found.
product/ERP5/Document/File.py
View file @
8aea5b39
...
...
@@ -36,7 +36,7 @@ from Products.ERP5.Document.Document import ConversionError
from
Products.ERP5Type.Base
import
Base
,
removeIContentishInterface
from
Products.CMFDefault.File
import
File
as
CMFFile
from
OFS.Image
import
Pdata
import
c
StringIO
from
cStringIO
import
StringIO
from
Products.ERP5Type.Utils
import
deprecated
def
_unpackData
(
data
):
...
...
@@ -172,24 +172,15 @@ class File(Document, CMFFile):
def
_setData
(
self
,
data
):
"""
"""
size
=
None
# update_data use len(data) when size is None, which breaks this method.
# define size = 0 will prevent len be use and keep the consistency of
# getData() and setData()
if
data
is
None
:
size
=
0
if
not
isinstance
(
data
,
Pdata
)
and
data
is
not
None
:
file
=
cStringIO
.
StringIO
(
data
)
data
,
size
=
self
.
_read_data
(
file
)
if
getattr
(
self
,
'update_data'
,
None
)
is
not
None
:
# We call this method to make sure size is set and caches reset
self
.
update_data
(
data
,
size
=
size
)
else
:
self
.
_baseSetData
(
data
)
# XXX - It would be better to always use this accessor
self
.
_setSize
(
size
)
self
.
ZCacheable_invalidate
()
self
.
ZCacheable_set
(
None
)
self
.
http__refreshEtag
()
data
,
size
=
self
.
_read_data
(
data
)
# We call this method to make sure size is set and caches reset
self
.
update_data
(
data
,
size
=
size
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getData'
)
def
getData
(
self
,
default
=
None
):
...
...
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