Commit d07675f8 authored by Vincent Pelletier's avatar Vincent Pelletier

Support on-the-fly creation of SQLCatalog objects in portal_catalog.

Factorise & simplify 2 tests.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11796 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cf0aa101
......@@ -578,9 +578,17 @@ class ObjectTemplateItem(BaseTemplateItem):
except KeyError:
# parent object can be set to nothing, in this case just go on
container_url = '/'.join(container_path)
if update_dict.has_key(container_url):
if update_dict[container_url] == 'nothing':
if update_dict.get(container_url) == 'nothing':
continue
# If container's container is portal_catalog,
# then automatically create the container.
elif container_path[-2] == 'portal_catalog':
container_container = portal.unrestrictedTraverse(container_path[:-1])
container_container.manage_addProduct['ZSQLCatalog'].manage_addSQLCatalog(id=container_path[-1], title='')
if len(container_container.objectIds()) == 1:
container_container.default_sql_catalog_id = container_path[-1]
container = portal.unrestrictedTraverse(container_path)
else:
raise
container_ids = container.objectIds()
subobjects_dict = {}
......
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