From 3835b203060e852436bd37c31924ec317f4f6fff Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Fri, 15 May 2009 13:18:36 +0000 Subject: [PATCH] Add a method that can make it possible to import a Business Template from base64 encoded text git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27006 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Tool/TemplateTool.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py index e12bc6ccab..dfdf7f1556 100644 --- a/product/ERP5/Tool/TemplateTool.py +++ b/product/ERP5/Tool/TemplateTool.py @@ -50,6 +50,7 @@ import posixpath from base64 import b64encode, b64decode from Products.ERP5Type.Message import translateString from zLOG import LOG, INFO +from base64 import decodestring WIN = os.name == 'nt' @@ -381,6 +382,15 @@ class TemplateTool (BaseTool): bt.build(no_action=1) return bt + def importBase64EncodedText(self, file_data=None, id=None, REQUEST=None, + batch_mode=0, **kw): + """ + Import Business Template from passed base64 encoded text. + """ + import_file = StringIO(decodestring(file_data)) + return self.importFile(import_file = import_file, id = id, REQUEST = REQUEST, + batch_mode = batch_mode, **kw) + def importFile(self, import_file=None, id=None, REQUEST=None, batch_mode=0, **kw): """ -- 2.30.9