From 089aed7bde0bbdcca672dd43c46a81dee9a1e2e8 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 15 Nov 2005 09:26:17 +0000
Subject: [PATCH] Create temporary directories in /tmp.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4322 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/TemplateTool.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py
index decf53712d..2ef6039850 100755
--- a/product/ERP5/Tool/TemplateTool.py
+++ b/product/ERP5/Tool/TemplateTool.py
@@ -136,12 +136,16 @@ class TemplateTool (BaseTool):
       """
         Export BT in tarball format 
       """
-      path = business_template.getTitle()
+      tmpfile_path = os.tmpnam()
+      tmpdir_path = os.path.dirname(tmpfile_path)
+      path = os.path.join(tmpdir_path, business_template.getTitle())
       export_string = business_template.export(path=path)
       if RESPONSE is not None:
         RESPONSE.setHeader('Content-type','tar/x-gzip')
         RESPONSE.setHeader('Content-Disposition',
-                           'inline;filename=%s-%s.bt5' % (business_template.getTitle(), business_template.getVersion()))
+                           'inline;filename=%s-%s.bt5' % \
+                               (business_template.getTitle(), 
+                                business_template.getVersion()))
       try:
         return export_string.getvalue()
       finally:
-- 
2.30.9