[Erp5-report] r37134 ivan - /erp5/trunk/products/ERP5OOo/Document/OOoDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jul 15 15:14:41 CEST 2010


Author: ivan
Date: Thu Jul 15 15:14:38 2010
New Revision: 37134

URL: http://svn.erp5.org?rev=37134&view=rev
Log:
Use IExtensibleTraversable miin implementation for OOoDocument.

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=37134&r1=37133&r2=37134&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] Thu Jul 15 15:14:38 2010
@@ -45,7 +45,7 @@ from Products.CMFCore.utils import getTo
 from Products.ERP5Type import Permissions, PropertySheet, Constraint
 from Products.ERP5Type.Cache import CachingMethod
 from Products.ERP5.Document.File import File
-from Products.ERP5.Document.Document import Document, PermanentURLMixIn,\
+from Products.ERP5.Document.Document import Document,\
 VALID_IMAGE_FORMAT_LIST, ConversionError, NotConvertedError
 from AccessControl.SecurityManagement import setSecurityManager
 from Products.ERP5Type.Utils import fill_args_from_request
@@ -54,6 +54,7 @@ from zLOG import LOG, ERROR
 # Mixin Import
 from Products.ERP5.mixin.base_convertable import BaseConvertableFileMixin
 from Products.ERP5.mixin.text_convertable import TextConvertableMixin
+from Products.ERP5.mixin.extensible_traversable import OOoDocumentExtensibleTraversableMixIn
 
 enc=base64.encodestring
 dec=base64.decodestring
@@ -90,7 +91,7 @@ class TimeoutTransport(SafeTransport):
     return SafeTransport.make_connection(self, h)
 
 
-class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
+class OOoDocument(OOoDocumentExtensibleTraversableMixIn, BaseConvertableFileMixin, File,
                                                TextConvertableMixin, Document):
   """
     A file document able to convert OOo compatible files to
@@ -441,24 +442,6 @@ class OOoDocument(PermanentURLMixIn, Bas
       zip_file.close()
       archive_file.close()
 
-  def _getExtensibleContent(self, request, name):
-    # Be sure that html conversion is done,
-    # as it is required to extract extensible content
-    old_manager, user = self._forceIdentification(request)
-    web_cache_kw = {'name': name,
-                    'format': EMBEDDED_FORMAT}
-    try:
-      self._convert(format='html')
-      _setCacheHeaders(_ViewEmulator().__of__(self), web_cache_kw)
-      mime, data = self.getConversion(format=EMBEDDED_FORMAT, file_name=name)
-      document = OFSFile(name, name, data, content_type=mime).__of__(self.aq_parent)
-    except (NotConvertedError, ConversionError, KeyError):
-      document = PermanentURLMixIn._getExtensibleContent(self, request, name)
-    # restore original security context if there's a logged in user
-    if user is not None:
-      setSecurityManager(old_manager)
-    return document
-
   security.declarePrivate('_convertToBaseFormat')
   def _convertToBaseFormat(self):
     """




More information about the Erp5-report mailing list