From f58200bfd3441214ff7d975aed9c1e7160008826 Mon Sep 17 00:00:00 2001
From: Leonardo Rochael Almeida <leonardo@nexedi.com>
Date: Thu, 14 Oct 2010 12:15:20 +0000
Subject: [PATCH] allow capturing the error raised by a business template that
 is not in any svn working copy and add an API to allow its creation in a
 configured repository

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39132 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Subversion/Tool/SubversionTool.py | 14 ++++++++++++++
 product/ERP5Subversion/__init__.py            |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/product/ERP5Subversion/Tool/SubversionTool.py b/product/ERP5Subversion/Tool/SubversionTool.py
index bedf81a8b9..deeab5849c 100644
--- a/product/ERP5Subversion/Tool/SubversionTool.py
+++ b/product/ERP5Subversion/Tool/SubversionTool.py
@@ -397,6 +397,20 @@ class SubversionTool(BaseTool):
     # Get the svn client object.
     return newSubversionClient(self, **kw)
   
+  security.declareProtected('Import/Export objects', 'createSubversionPath')
+  def createSubversionPath(self, working_copy, business_template):
+    """
+     create the working copy path corresponding to the given business
+     template, checking it is in the working copy list in preferences
+    """
+    bt_name = business_template.getTitle()
+    assert bt_name == os.path.basename(bt_name), 'Invalid bt_name'
+    working_copy = self._getWorkingPath(working_copy)
+    wc_path = os.path.join(working_copy, bt_name)
+    os.mkdir(wc_path)
+    client = self._getClient()
+    client.add([wc_path])
+
   security.declareProtected('Import/Export objects', 'getSubversionPath')
   def getSubversionPath(self, business_template, with_name=True):
     """
diff --git a/product/ERP5Subversion/__init__.py b/product/ERP5Subversion/__init__.py
index d3cfe24c6a..4ac17d760f 100644
--- a/product/ERP5Subversion/__init__.py
+++ b/product/ERP5Subversion/__init__.py
@@ -55,7 +55,9 @@ def initialize( context ):
                          content_classes = content_classes)
 
 from AccessControl.SecurityInfo import allow_module
+from AccessControl.SecurityInfo import ModuleSecurityInfo
 
 allow_module('Products.ERP5Subversion.SubversionClient')
+ModuleSecurityInfo('Products.ERP5Subversion.Tool.SubversionTool').declarePublic('SubversionUnknownBusinessTemplateError')
 
 
-- 
2.30.9