[Erp5-report] r40747 hugo.maia - in /erp5/trunk/utils/cloudooo/cloudooo: ./ interfaces/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Nov 26 00:06:10 CET 2010
Author: hugo.maia
Date: Fri Nov 26 00:06:09 2010
New Revision: 40747
URL: http://svn.erp5.org?rev=40747&view=rev
Log:
Add granulateFile to manager interface
Modified:
erp5/trunk/utils/cloudooo/cloudooo/interfaces/manager.py
erp5/trunk/utils/cloudooo/cloudooo/manager.py
erp5/trunk/utils/cloudooo/cloudooo/tests/testInterface.py
Modified: erp5/trunk/utils/cloudooo/cloudooo/interfaces/manager.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/interfaces/manager.py?rev=40747&r1=40746&r2=40747&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/interfaces/manager.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/interfaces/manager.py [utf8] Fri Nov 26 00:06:09 2010
@@ -55,6 +55,9 @@ class IManager(Interface):
"""Returns a list extension which can be generated from given extension or
document type."""
+ def granulateFile(file, source_format, zip):
+ """Returns a zip file with parts of an document splited by grains."""
+
class IERP5Compatibility(Interface):
""" Provides compatibility interface with ERP5 Project.
Modified: erp5/trunk/utils/cloudooo/cloudooo/manager.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/manager.py?rev=40747&r1=40746&r2=40747&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/manager.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/manager.py [utf8] Fri Nov 26 00:06:09 2010
@@ -67,25 +67,23 @@ class Manager(object):
return encodestring(decode_data)
def granulateFile(self, file, source_format, zip=False):
- """Returns an zip file? with parts of an document splited by grains.
+ """Returns the parts of an document splited by grains.
Keywords arguments:
file -- File as string in base64
source_format -- Format of original file as string
- zip -- Boolean Attribute. If true, returns the file in the form of a
+ zip -- Boolean Attribute. If true, returns the grains in the form of a
zip archive
"""
raise NotImplemented
- # Pseudo Implementation done by rafael
GRANULATABLE_FORMAT_LIST = ("odt",)
if source_format not in GRANULATABLE_FORMAT_LIST:
file = self.convertFile(file, source_format, GRANULATABLE_FORMAT_LIST[0], zip=False)
from granulate.oogranulate import OOGranulate
- document = OOGranulate(self._path_tmp_dir,
- decodestring(file),
+ document = OOGranulate(decodestring(file),
source_format)
- grain_zip = document.granulate(zip=True) # Return a zip with all grains
- # zip = content of a zip file.
- return encodestring(grain_zip)
+ grains = document.granulate(zip)
+
+ return encodestring(grains)
def updateFileMetadata(self, file, source_format, metadata_dict):
"""Receives the string of document and a dict with metadatas. The metadata
Modified: erp5/trunk/utils/cloudooo/cloudooo/tests/testInterface.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/tests/testInterface.py?rev=40747&r1=40746&r2=40747&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/tests/testInterface.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/tests/testInterface.py [utf8] Fri Nov 26 00:06:09 2010
@@ -98,7 +98,8 @@ class TestInterface(unittest.TestCase):
method_list = ['convertFile',
'getFileMetadataItemList',
'updateFileMetadata',
- 'getAllowedExtensionList']
+ 'getAllowedExtensionList',
+ 'granulateFile']
for method in method_list:
self.assertEquals(method in IManager.names(), True)
More information about the Erp5-report
mailing list