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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
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
...
@@ -36,7 +36,7 @@ from Products.ERP5.Document.Document import ConversionError
from
Products.ERP5Type.Base
import
Base
,
removeIContentishInterface
from
Products.ERP5Type.Base
import
Base
,
removeIContentishInterface
from
Products.CMFDefault.File
import
File
as
CMFFile
from
Products.CMFDefault.File
import
File
as
CMFFile
from
OFS.Image
import
Pdata
from
OFS.Image
import
Pdata
import
c
StringIO
from
cStringIO
import
StringIO
from
Products.ERP5Type.Utils
import
deprecated
from
Products.ERP5Type.Utils
import
deprecated
def
_unpackData
(
data
):
def
_unpackData
(
data
):
...
@@ -172,24 +172,15 @@ class File(Document, CMFFile):
...
@@ -172,24 +172,15 @@ class File(Document, CMFFile):
def
_setData
(
self
,
data
):
def
_setData
(
self
,
data
):
"""
"""
"""
"""
size
=
None
# update_data use len(data) when size is None, which breaks this method.
# 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
# define size = 0 will prevent len be use and keep the consistency of
# getData() and setData()
# getData() and setData()
if
data
is
None
:
if
data
is
None
:
size
=
0
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
:
else
:
self
.
_baseSetData
(
data
)
# XXX - It would be better to always use this accessor
data
,
size
=
self
.
_read_data
(
data
)
self
.
_setSize
(
size
)
# We call this method to make sure size is set and caches reset
self
.
ZCacheable_invalidate
()
self
.
update_data
(
data
,
size
=
size
)
self
.
ZCacheable_set
(
None
)
self
.
http__refreshEtag
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getData'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getData'
)
def
getData
(
self
,
default
=
None
):
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