[Erp5-report] r32359 jerome - in /erp5/trunk/products: ERP5/Document/ ERP5/interfaces/ ERP5...
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 9 14:55:57 CET 2010
Author: jerome
Date: Tue Feb 9 14:55:56 2010
New Revision: 32359
URL: http://svn.erp5.org?rev=32359&view=rev
Log:
Protect convert method by Access Content Information, and document in the
interface that this method may raise ConversionError if conversion is not
allowed, or Unauthorized if conversion is not permitted.
Review by Nicolas
Modified:
erp5/trunk/products/ERP5/Document/Document.py
erp5/trunk/products/ERP5/Document/Image.py
erp5/trunk/products/ERP5/Document/PDFDocument.py
erp5/trunk/products/ERP5/Document/TextDocument.py
erp5/trunk/products/ERP5/interfaces/convertable.py
erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=32359&r1=32358&r2=32359&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Tue Feb 9 14:55:56 2010
@@ -1104,7 +1104,7 @@
return method()
# Conversion methods
- security.declareProtected(Permissions.ModifyPortalContent, 'convert')
+ security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, **kw):
"""
Main content conversion function, returns result which should
@@ -1278,7 +1278,7 @@
"""
if getattr(self, 'hasData', None) is not None and not self.hasData():
# Empty document cannot be converted
- return #'Document is empty'
+ return
try:
message = self._convertToBaseFormat() # Call implemetation method
self.clearConversionCache() # Conversion cache is now invalid
Modified: erp5/trunk/products/ERP5/Document/Image.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Image.py?rev=32359&r1=32358&r2=32359&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Image.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Image.py [utf8] Tue Feb 9 14:55:56 2010
@@ -325,7 +325,7 @@
return mime_type, result
# Conversion API
- security.declareProtected(Permissions.ModifyPortalContent, 'convert')
+ security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, display=None, quality=75, resolution=None, frame=None, **kw):
"""
Implementation of conversion for Image files
Modified: erp5/trunk/products/ERP5/Document/PDFDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PDFDocument.py?rev=32359&r1=32358&r2=32359&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PDFDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PDFDocument.py [utf8] Tue Feb 9 14:55:56 2010
@@ -101,7 +101,7 @@
resolution=resolution, frame=frame)
# Conversion API
- security.declareProtected(Permissions.ModifyPortalContent, 'convert')
+ security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, **kw):
"""
Implementation of conversion for PDF files
Modified: erp5/trunk/products/ERP5/Document/TextDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TextDocument.py?rev=32359&r1=32358&r2=32359&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] Tue Feb 9 14:55:56 2010
@@ -195,7 +195,7 @@
substitution_method_parameter_dict = {}
return self._substituteTextContent(subject, **substitution_method_parameter_dict)
- security.declareProtected(Permissions.View, 'convert')
+ security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, substitution_method_parameter_dict=None, **kw):
"""
Convert text using portal_transforms or oood
Modified: erp5/trunk/products/ERP5/interfaces/convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/convertable.py?rev=32359&r1=32358&r2=32359&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/convertable.py [utf8] Tue Feb 9 14:55:56 2010
@@ -45,6 +45,10 @@
taking into account optional parameters. This method
returns a tuple of two values: a mime type string and
the converted data.
+
+ This methods raises a ConversionError if the target format
+ is not allowed, or an Unauthorized error if the target format
+ is not permitted.
format -- the target conversion format specified either as an
extension (ex. 'png') or as a mime type
@@ -104,4 +108,4 @@
Returns the list of acceptable formats for conversion
where format is an extension (ex. 'png') which can be
passed to IConvertable.convert or to IDownloadable.index_html
- """
+ """
Modified: erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Document/OOoDocument.py?rev=32359&r1=32358&r2=32359&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] Tue Feb 9 14:55:56 2010
@@ -353,7 +353,7 @@
return response_dict['mime'], Pdata(dec(response_dict['data']))
# Conversion API
- security.declareProtected(Permissions.View, 'convert')
+ security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, display=None, **kw):
"""Convert the document to the given format.
More information about the Erp5-report
mailing list