From daa4b7c3a31e7f1780a591e6454bf40742b60390 Mon Sep 17 00:00:00 2001
From: Lucas Carvalho <lucas@nexedi.com>
Date: Mon, 10 Aug 2009 14:05:30 +0000
Subject: [PATCH] improved WebSite_setupECommerceWebSite, it must remove web
 section before creation to avoid BadRequest error.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28322 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_commerce/WebSite_setupECommerceWebSite.xml       | 8 ++++++++
 bt5/erp5_commerce/bt/revision                             | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/WebSite_setupECommerceWebSite.xml b/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/WebSite_setupECommerceWebSite.xml
index f12d3cd58d..2d4bd1b6a4 100644
--- a/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/WebSite_setupECommerceWebSite.xml
+++ b/bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/WebSite_setupECommerceWebSite.xml
@@ -61,6 +61,11 @@ if (context.getPortalType() != \'Web Site\'):\n
                                        })\n
 \n
 # creation the default sections\n
+object_id_list = [\'cart\', \'checkout\', \'account\', \'register\']\n
+for id in object_id_list:\n
+  if id in context.objectIds():\n
+    context.manage_delObjects([id])\n
+\n
 cart_section = context.newContent(portal_type=\'Web Section\', title=\'Cart\', id=\'cart\')\n
 checkout_section = context.newContent(portal_type=\'Web Section\', title=\'Checkout\', id=\'checkout\')\n
 account_section = context.newContent(portal_type=\'Web Section\', title=\'My account\', id=\'account\')\n
@@ -135,6 +140,9 @@ context.Base_redirect(\'\', keep_items={\n
                             <string>context</string>
                             <string>translateString</string>
                             <string>dict</string>
+                            <string>object_id_list</string>
+                            <string>_getiter_</string>
+                            <string>id</string>
                             <string>cart_section</string>
                             <string>checkout_section</string>
                             <string>account_section</string>
diff --git a/bt5/erp5_commerce/bt/revision b/bt5/erp5_commerce/bt/revision
index 5d1277e790..4b9bce4823 100644
--- a/bt5/erp5_commerce/bt/revision
+++ b/bt5/erp5_commerce/bt/revision
@@ -1 +1 @@
-147
\ No newline at end of file
+148
\ No newline at end of file
-- 
2.30.9