Commit 19a3c582 authored by Aurel's avatar Aurel

remove check for ligth_install parameter for old bt version and use

getParentValue when uninstall zsql method


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12094 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 16d1962c
...@@ -793,7 +793,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -793,7 +793,7 @@ class ObjectTemplateItem(BaseTemplateItem):
container.manage_delObjects([object_id]) container.manage_delObjects([object_id])
if container.aq_parent.meta_type == 'ERP5 Catalog' and len(container.objectIds()) == 0: if container.aq_parent.meta_type == 'ERP5 Catalog' and len(container.objectIds()) == 0:
# We are removing a ZSQLMethod, remove the SQLCatalog if empty # We are removing a ZSQLMethod, remove the SQLCatalog if empty
container.aq_parent.manage_delObjects([container.id]) container.getParentValue().manage_delObjects([container.id])
except (NotFound, KeyError, BadRequest): except (NotFound, KeyError, BadRequest):
# object is already backup and/or removed # object is already backup and/or removed
pass pass
...@@ -1041,44 +1041,41 @@ class CategoryTemplateItem(ObjectTemplateItem): ...@@ -1041,44 +1041,41 @@ class CategoryTemplateItem(ObjectTemplateItem):
portal = context.getPortalObject() portal = context.getPortalObject()
category_tool = portal.portal_categories category_tool = portal.portal_categories
tool_id = self.tool_id tool_id = self.tool_id
if light_install==0: for relative_url in self._archive.keys():
ObjectTemplateItem.install(self, context, trashbin, **kw) obj = self._archive[relative_url]
else: # Wrap the object by an aquisition wrapper for _aq_dynamic.
for relative_url in self._archive.keys(): obj = obj.__of__(category_tool)
obj = self._archive[relative_url] container_path = relative_url.split('/')[0:-1]
# Wrap the object by an aquisition wrapper for _aq_dynamic. category_id = relative_url.split('/')[-1]
obj = obj.__of__(category_tool) container = category_tool.unrestrictedTraverse(container_path)
container_path = relative_url.split('/')[0:-1] container_ids = container.objectIds()
category_id = relative_url.split('/')[-1] if category_id in container_ids: # Object already exists
container = category_tool.unrestrictedTraverse(container_path) # XXX call backup here
container_ids = container.objectIds() subobjects_dict = self._backupObject('backup', trashbin, container_path, category_id)
if category_id in container_ids: # Object already exists container.manage_delObjects([category_id])
# XXX call backup here category = container.newContent(portal_type=obj.getPortalType(), id=category_id)
subobjects_dict = self._backupObject('backup', trashbin, container_path, category_id) for prop in obj.propertyIds():
container.manage_delObjects([category_id]) if prop not in ('id', 'uid'):
category = container.newContent(portal_type=obj.getPortalType(), id=category_id) try:
for prop in obj.propertyIds(): prop_value = obj.getProperty(prop, evaluate=0)
if prop not in ('id', 'uid'): except TypeError: # the getter doesn't support evaluate=
try: prop_value = obj.getProperty(prop)
prop_value = obj.getProperty(prop, evaluate=0) category.setProperty(prop, prop_value)
except TypeError: # the getter doesn't support evaluate= # import sub objects if there is
prop_value = obj.getProperty(prop) if len(subobjects_dict) > 0:
category.setProperty(prop, prop_value) # get a jar
# import sub objects if there is connection = obj._p_jar
if len(subobjects_dict) > 0: o = category
# get a jar while connection is None:
connection = obj._p_jar o = o.aq_parent
o = category connection = o._p_jar
while connection is None: # import subobjects
o = o.aq_parent for subobject_id in subobjects_dict.keys():
connection = o._p_jar subobject_data = subobjects_dict[subobject_id]
# import subobjects subobject_data.seek(0)
for subobject_id in subobjects_dict.keys(): subobject = connection.importFile(subobject_data)
subobject_data = subobjects_dict[subobject_id] if subobject_id not in category.objectIds():
subobject_data.seek(0) category._setObject(subobject_id, subobject)
subobject = connection.importFile(subobject_data)
if subobject_id not in category.objectIds():
category._setObject(subobject_id, subobject)
class SkinTemplateItem(ObjectTemplateItem): class SkinTemplateItem(ObjectTemplateItem):
......
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