[Erp5-report] r35996 nicolas - /erp5/trunk/products/ERP5OOo/Document/OOoDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 4 15:21:35 CEST 2010


Author: nicolas
Date: Fri Jun  4 15:21:34 2010
New Revision: 35996

URL: http://svn.erp5.org?rev=35996&view=rev
Log:
* rename _convert into _getConversionFromProxyServer
* then rename convert into _convert
This insure that all convert method use the same implementation
and improve consistency between all types of documents.

see Products.ERP5.mixin.document.convert


Modified:
    erp5/trunk/products/ERP5OOo/Document/OOoDocument.py

Modified: erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Document/OOoDocument.py?rev=35996&r1=35995&r2=35996&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] Fri Jun  4 15:21:34 2010
@@ -262,7 +262,7 @@
     """
     return format in self.getTargetFormatList()
 
-  def _convert(self, format):
+  def _getConversionFromProxyServer(self, format):
     """
       Communicates with server to convert a file 
     """
@@ -297,14 +297,12 @@
     return response_dict['mime'], Pdata(dec(response_dict['data']))
 
   # Conversion API
-  security.declareProtected(Permissions.AccessContentsInformation, 'convert')
-  def convert(self, format, display=None, **kw):
+  def _convert(self, format, display=None, **kw):
     """Convert the document to the given format.
 
     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():
@@ -351,7 +349,7 @@
         #Text conversion is not supported by oood, do it in other way
         if not self.hasConversion(format=original_format):
           #Do real conversion for text
-          mime, data = self._convert(format='text-content')
+          mime, data = self._getConversionFromProxyServer(format='text-content')
           self.setConversion(data, mime, format=original_format)
           return mime, data
         return self.getConversion(format=original_format)
@@ -373,7 +371,7 @@
       has_format = self.hasConversion(format=original_format, display=display)
     if not has_format:
       # Do real conversion
-      mime, data = self._convert(format)
+      mime, data = self._getConversionFromProxyServer(format)
       if is_html:
         # Extra processing required since
         # we receive a zip file
@@ -440,7 +438,7 @@
       format_list = [x for x in self.getTargetFormatList()
                                 if x.startswith('html') or x.endswith('html')]
       format = format_list[0]
-      mime, data = self._convert(format)
+      mime, data = self._getConversionFromProxyServer(format)
       archive_file = cStringIO.StringIO()
       archive_file.write(str(data))
       zip_file = zipfile.ZipFile(archive_file)




More information about the Erp5-report mailing list