Commit 9f4f4636 authored by Rafael Monnerat's avatar Rafael Monnerat

Added pseudo code for granulate.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@40508 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d84efdc5
......@@ -64,6 +64,27 @@ class Manager(object):
decode_data = document.convert(destination_format)
return encodestring(decode_data)
def granulateFile(self, file, source_format, zip=False):
"""Returns an zip file? with 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 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),
source_format)
grain_zip = document.granulate(zip=True) # Return a zip with all grains
# zip = content of a zip file.
return encodestring(grain_zip)
def updateFileMetadata(self, file, source_format, metadata_dict):
"""Receives the string of document and a dict with metadatas. The metadata
is added in document.
......
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