Commit c91aad38 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Overload edit to support file upload.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13442 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9427a0bd
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import _setCacheHeaders from Products.CMFCore.utils import _setCacheHeaders
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
...@@ -87,6 +88,24 @@ class TextDocument(Document, TextContent): ...@@ -87,6 +88,24 @@ class TextDocument(Document, TextContent):
security.declareProtected(Permissions.View, 'manage_FTPget') security.declareProtected(Permissions.View, 'manage_FTPget')
manage_FTPget = TextContent.manage_FTPget manage_FTPget = TextContent.manage_FTPget
# File handling
security.declarePrivate( '_edit' )
def _edit(self, **kw):
"""\
This is used to edit files which contain HTML content.
"""
if kw.has_key('file'):
file = kw.get('file')
text_content = file.read()
headers, body, format = self.handleText(text=text_content)
kw.setdefault('text_format', format)
kw.setdefault('text_content', text_content)
del kw['file']
Document._edit(self, **kw)
security.declareProtected( Permissions.ModifyPortalContent, 'edit' )
edit = WorkflowMethod( _edit )
# Default Display # Default Display
security.declareProtected(Permissions.View, 'index_html') security.declareProtected(Permissions.View, 'index_html')
def index_html(self, REQUEST, RESPONSE, format=None, **kw): def index_html(self, REQUEST, RESPONSE, format=None, **kw):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment