Commit c9db3aee authored by Mame Coumba Sall's avatar Mame Coumba Sall

Modified to revert back to revision before 34090


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34148 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8e501200
......@@ -48,13 +48,10 @@ from Products.ERP5.Document.File import File
from Products.ERP5.Document.Document import PermanentURLMixIn
from Products.ERP5.Document.Document import ConversionError
from Products.ERP5.Document.Document import NotConvertedError
from AccessControl.SecurityManagement import getSecurityManager
from zLOG import LOG, ERROR
# Mixin Import
from Products.ERP5.mixin.cached_convertable import CachedConvertableMixin
from Products.ERP5.mixin.convertable import ConvertableMixin
from Products.ERP5.mixin.base_convertable import BaseConvertableMixin
enc=base64.encodestring
dec=base64.decodestring
......@@ -91,7 +88,7 @@ class TimeoutTransport(SafeTransport):
return SafeTransport.make_connection(self, h)
class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin, BaseConvertableMixin, ConvertableMixin):
class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin):
"""
A file document able to convert OOo compatible files to
any OOo supported format, to capture metadata and to
......@@ -187,7 +184,9 @@ class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin, BaseConvertab
_setCacheHeaders(_ViewEmulator().__of__(self), {'format' : format})
# Verify that the format is acceptable (from permission point of view)
if self.isTargetFormatPermitted(format)==False:
method = self._getTypeBasedMethod('checkConversionFormatPermission',
fallback_script_id = 'Document_checkConversionFormatPermission')
if not method(format=format):
raise Unauthorized("OOoDocument: user does not have enough permission to access document"
" in %s format" % (format or 'original'))
......@@ -281,6 +280,7 @@ class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin, BaseConvertab
warn('Your oood version is too old, using old method '
'getAllowedTargets instead of getAllowedTargetList',
DeprecationWarning)
# tuple order is reversed to be compatible with ERP5 Form
return [(y, x) for x, y in allowed]
......@@ -313,11 +313,10 @@ class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin, BaseConvertab
def isTargetFormatAllowed(self, format):
"""
Checks if the current document can be converted
into the specified target format
into the specified target format.
"""
return format in self.getTargetFormatList()
security.declarePrivate('_convert')
def _convert(self, format):
"""
......@@ -410,10 +409,6 @@ class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin, BaseConvertab
# Raise an error if the format is not supported
if not self.isTargetFormatAllowed(format):
raise ConversionError("OOoDocument: target format %s is not supported" % format)
# Raise an error if the format is not permitted
if not self.isTargetFormatPermitted(format):
raise Unauthorized("OOoDocument: user does not have enough permission to access document"
" in %s format" % (format or 'original'))
# Check if we have already a base conversion
if not self.hasBaseData():
raise NotConvertedError
......
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