From 5bc4f52423ba5a6b8febfeaee4335be25fcb009c Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Fri, 14 May 2004 19:10:54 +0000 Subject: [PATCH] When installing a Z SQL Method, make sure that the sql connection is valid in this portal. If not, set it to the first one found in this portal. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@883 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/BusinessTemplate.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 275e95f085..f21dbe0128 100755 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -78,6 +78,12 @@ class ObjectTemplateItem(Implicit): container._importObjectFromFile(cStringIO.StringIO(self.export_string)) #else: # container._importObjectFromFile(cStringIO.StringIO(self.export_string)) + ob = container[object_id] + if ob.meta_type in ('Z SQL Method',): + # It is necessary to make sure that the sql connection in this method is valid. + sql_connection_list = portal.objectIds(spec=('Z MySQL Database Connection',)) + if ob.connection_id not in sql_connection_list: + ob.connection_id = sql_connection_list[0] class PortalTypeTemplateItem(Implicit): """ -- 2.30.9