diff --git a/bt5/erp5_configurator/ExtensionTemplateItem/ConfigurationTemplate_readOOoCalcFile.py b/bt5/erp5_configurator/ExtensionTemplateItem/ConfigurationTemplate_readOOoCalcFile.py index 4a5711720e47eacc246d11d6bd7a15443b7542c9..3b5349b509a408c52c8bc2a7a36aecac8d920407 100644 --- a/bt5/erp5_configurator/ExtensionTemplateItem/ConfigurationTemplate_readOOoCalcFile.py +++ b/bt5/erp5_configurator/ExtensionTemplateItem/ConfigurationTemplate_readOOoCalcFile.py @@ -27,14 +27,20 @@ # ############################################################################## +# This extension should be replaced by a clever parser provided by +# ERP5OOo or probably by CloudOOo itself. + import StringIO -def read(self, filename): +def read(self, filename, data): """ Return a OOCalc as a StringIO """ - oo_template_file = getattr(self, filename) - fp = StringIO.StringIO(oo_template_file) + if data is None: + oo_template_file = getattr(self, filename) + fp = StringIO.StringIO(oo_template_file) + else: + fp = StringIO.StringIO(data) fp.filename = filename return fp @@ -67,10 +73,10 @@ def getIdFromString(string): break return clean_id -def convert(self, filename): +def convert(self, filename, data=None): from Products.ERP5OOo.OOoUtils import OOoParser OOoParser = OOoParser() - import_file = read(self, filename) + import_file = read(self, filename, data) # Extract tables from the speadsheet file OOoParser.openFile(import_file)