From 2f51cd9f8a951f305812073330db322610bef85a Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Tue, 22 Apr 2008 12:42:18 +0000
Subject: [PATCH] Avoid Conversion When calling OOoStylesheet

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20747 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/OOoTemplate.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/product/ERP5OOo/OOoTemplate.py b/product/ERP5OOo/OOoTemplate.py
index 4b2c1b2d87..95a66a6aae 100644
--- a/product/ERP5OOo/OOoTemplate.py
+++ b/product/ERP5OOo/OOoTemplate.py
@@ -461,11 +461,16 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0">
       raise ValueError, 'Can not render a template without a parent acquisition context'
     # Retrieve master document
     ooo_document = getattr(here, self.ooo_stylesheet)
-    # If style is dynamic, call it
+    format = request.get('format')
     try:
-      ooo_document = ooo_document()
-    except AttributeError:
-      pass
+      # If style is dynamic, call it
+      try:
+        request.set('format', None)
+        ooo_document = ooo_document()
+      except AttributeError:
+        pass
+    finally:
+        request.set('format', format)
     # Create a new builder instance
     ooo_builder = OOoBuilder(ooo_document)
     # Pass builder instance as extra_context
-- 
2.30.9