Commit 5bc4f524 authored by Yoshinori Okuji's avatar Yoshinori Okuji

When installing a Z SQL Method, make sure that the sql connection is valid in...

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
parent a6e58159
......@@ -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):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment