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
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
0f944d83
Commit
0f944d83
authored
Dec 17, 2020
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reapply removal of CMFFile that got lost in merge
parent
b04d0e85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.File.py
...umentTemplateItem/portal_components/document.erp5.File.py
+26
-11
No files found.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.File.py
View file @
0f944d83
...
...
@@ -34,7 +34,7 @@ from erp5.component.document.Document import Document, VALID_TEXT_FORMAT_LIST
from
erp5.component.document.Document
import
VALID_IMAGE_FORMAT_LIST
from
erp5.component.document.Document
import
ConversionError
from
Products.ERP5Type.Base
import
Base
,
removeIContentishInterface
from
Products.CMFDefault.File
import
File
as
CMF
File
from
OFS.Image
import
File
as
OFS_
File
from
Products.ERP5Type.Utils
import
deprecated
def
_unpackData
(
data
):
...
...
@@ -46,7 +46,7 @@ def _unpackData(data):
_MARKER
=
object
()
class
File
(
Document
,
CMF
File
):
class
File
(
Document
,
OFS_
File
):
"""
A File can contain raw data which can be uploaded and downloaded.
It is the root class of Image, OOoDocument (ERP5OOo product),
...
...
@@ -110,8 +110,14 @@ class File(Document, CMFFile):
filename
=
kw
.
get
(
'filename'
)
if
filename
:
self
.
_setFilename
(
filename
)
if
self
.
_isNotEmpty
(
file_object
):
self
.
_setFile
(
file_object
,
precondition
=
precondition
)
if
file_object
is
not
None
:
# XXX: Rather than doing nothing if empty, consider changing:
# - _update_image_info to clear metadata
# - interactions to do nothing (or else?)
file_object
.
seek
(
0
,
2
)
if
file_object
.
tell
():
file_object
.
seek
(
0
)
self
.
_setFile
(
file_object
)
Base
.
_edit
(
self
,
**
kw
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'edit'
)
...
...
@@ -138,11 +144,15 @@ class File(Document, CMFFile):
return
None
def
_setFile
(
self
,
data
,
precondition
=
None
):
if
data
is
not
None
and
self
.
hasData
()
and
\
str
(
data
.
read
())
==
str
(
self
.
getData
()):
# Same data as previous, no need to change it's content
if
data
is
None
:
return
if
str
(
data
.
read
())
==
(
self
.
hasData
()
and
str
(
self
.
getData
())):
# Same data as previous, no need to change its content
return
CMFFile
.
_edit
(
self
,
precondition
=
precondition
,
file
=
data
)
if
data
.
tell
():
data
.
seek
(
0
)
self
.
manage_upload
(
data
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setFile'
)
def
setFile
(
self
,
data
,
precondition
=
None
):
...
...
@@ -176,11 +186,16 @@ class File(Document, CMFFile):
return
str
(
data
)
# DAV Support
PUT
=
CMFFile
.
PUT
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'PUT'
)
def
PUT
(
self
,
REQUEST
,
RESPONSE
):
"""from Products.CMFDefault.File"""
OFS_File
.
PUT
(
self
,
REQUEST
,
RESPONSE
)
self
.
reindexObject
()
security
.
declareProtected
(
Permissions
.
FTPAccess
,
'manage_FTPstat'
,
'manage_FTPlist'
)
manage_FTPlist
=
CMF
File
.
manage_FTPlist
manage_FTPstat
=
CMF
File
.
manage_FTPstat
manage_FTPlist
=
OFS_
File
.
manage_FTPlist
manage_FTPstat
=
OFS_
File
.
manage_FTPstat
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getMimeTypeAndContent'
)
def
getMimeTypeAndContent
(
self
):
...
...
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