[Erp5-report] r13442 - /erp5/trunk/products/ERP5/Document/TextDocument.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 16 00:27:32 CET 2007
Author: jp
Date: Fri Mar 16 00:27:30 2007
New Revision: 13442
URL: http://svn.erp5.org?rev=13442&view=rev
Log:
Overload edit to support file upload.
Modified:
erp5/trunk/products/ERP5/Document/TextDocument.py
Modified: erp5/trunk/products/ERP5/Document/TextDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TextDocument.py?rev=13442&r1=13441&r2=13442&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py Fri Mar 16 00:27:30 2007
@@ -28,6 +28,7 @@
from AccessControl import ClassSecurityInfo
+from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import _setCacheHeaders
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
@@ -87,6 +88,24 @@
security.declareProtected(Permissions.View, '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
security.declareProtected(Permissions.View, 'index_html')
def index_html(self, REQUEST, RESPONSE, format=None, **kw):
More information about the Erp5-report
mailing list