From 4f5de7e0d1e2a2ff6c030c5f48f914ffdda17874 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Tue, 19 Sep 2006 12:00:51 +0000
Subject: [PATCH] allows importing templates when the catalog method filter
 does not use an Expression

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10151 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 9e4b5da9ec..ff8def6291 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -1245,7 +1245,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
           workflow_name = workflow[1:]
         else:
           workflow_name = workflow
-        if workflow[0]!= '-' and \
+        if workflow[0] != '-' and \
             workflow_name not in chain_dict['chain_%s' % portal_type]:
           raise NotFound, 'workflow %s not found in chain for portal_type %s'\
                 % (workflow, portal_type)
@@ -1815,7 +1815,10 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
         key = method.getAttribute('key')
         key_type = str(method.getAttribute('type'))
         if key_type == "str":
-          value = str(method.getElementsByTagName('value')[0].childNodes[0].data)
+          if len(method.getElementsByTagName('value')[0].childNodes):
+            value = str(method.getElementsByTagName('value')[0].childNodes[0].data)
+          else:
+            value = ''
           key = str(key)
         elif key_type == "int":
           value = int(method.getElementsByTagName('value')[0].childNodes[0].data)
-- 
2.30.9