Commit 0db7cfc9 authored by Rafael Monnerat's avatar Rafael Monnerat

Also support data parameter instead only file id

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42126 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 42f7064a
...@@ -27,14 +27,20 @@ ...@@ -27,14 +27,20 @@
# #
############################################################################## ##############################################################################
# This extension should be replaced by a clever parser provided by
# ERP5OOo or probably by CloudOOo itself.
import StringIO import StringIO
def read(self, filename): def read(self, filename, data):
""" """
Return a OOCalc as a StringIO Return a OOCalc as a StringIO
""" """
oo_template_file = getattr(self, filename) if data is None:
fp = StringIO.StringIO(oo_template_file) oo_template_file = getattr(self, filename)
fp = StringIO.StringIO(oo_template_file)
else:
fp = StringIO.StringIO(data)
fp.filename = filename fp.filename = filename
return fp return fp
...@@ -67,10 +73,10 @@ def getIdFromString(string): ...@@ -67,10 +73,10 @@ def getIdFromString(string):
break break
return clean_id return clean_id
def convert(self, filename): def convert(self, filename, data=None):
from Products.ERP5OOo.OOoUtils import OOoParser from Products.ERP5OOo.OOoUtils import OOoParser
OOoParser = OOoParser() OOoParser = OOoParser()
import_file = read(self, filename) import_file = read(self, filename, data)
# Extract tables from the speadsheet file # Extract tables from the speadsheet file
OOoParser.openFile(import_file) OOoParser.openFile(import_file)
......
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