Commit 4bd23876 authored by Nicolas Delaby's avatar Nicolas Delaby

All convert() methods become _convert() (private one is real implemtation).

As a reminder convert() aims to check Conversion Format Permission.
remove obsolete security statements



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35749 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3176bb40
......@@ -427,6 +427,7 @@ class EmailDocument(TextDocument):
main content (text/plain).
TODO: add support for legacy objects
"""
self._checkConversionFormatPermission(None)
if not self.hasFile() or self._baseGetTextContent() is not None:
# Return the standard text content if no file was provided
# Or standard text content is not empty.
......
......@@ -323,8 +323,7 @@ class Image(TextConvertableMixin, File, OFSImage):
return mime_type, result
# Conversion API
security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, **kw):
def _convert(self, format, **kw):
"""
Implementation of conversion for Image files
"""
......
......@@ -67,8 +67,7 @@ class PDFDocument(Image):
)
# Conversion API
security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, **kw):
def _convert(self, format, **kw):
"""
Implementation of conversion for PDF files
"""
......@@ -89,7 +88,7 @@ class PDFDocument(Image):
self.setConversion(data, mime=mime, format='txt')
return (mime, data)
else:
return Image.convert(self, format, **kw)
return Image._convert(self, format, **kw)
security.declareProtected(Permissions.ModifyPortalContent, 'populateContent')
def populateContent(self):
......
......@@ -131,8 +131,7 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
return self._substituteTextContent(subject, safe_substitute=safe_substitute,
**substitution_method_parameter_dict)
security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, substitution_method_parameter_dict=None,
def _convert(self, format, substitution_method_parameter_dict=None,
safe_substitute=True, charset=None, text_content=None, **kw):
"""
Convert text using portal_transforms or oood
......@@ -239,6 +238,7 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
def getBaseData(self, default=_MARKER):
"""
"""
self._checkConversionFormatPermission(None, **kw)
if default is _MARKER:
return self.getTextContent()
else:
......
......@@ -262,7 +262,6 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
"""
return format in self.getTargetFormatList()
security.declarePrivate('_convert')
def _convert(self, format):
"""
Communicates with server to convert a file
......@@ -305,6 +304,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
If a conversion is already stored for this format, it is returned
directly, otherwise the conversion is stored for the next time.
"""
self._checkConversionFormatPermission(format, **kw)
#XXX if document is empty, stop to try to convert.
#XXX but I don't know what is a appropriate mime-type.(Yusei)
if not self.hasData():
......
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