Commit e31fe87c authored by Aurel's avatar Aurel

use getOb to also check catalog at uninstall

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13547 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3978a8dc
...@@ -804,9 +804,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -804,9 +804,7 @@ class ObjectTemplateItem(BaseTemplateItem):
object_id = relative_url.split('/')[-1] object_id = relative_url.split('/')[-1]
try: try:
container = portal.unrestrictedTraverse(container_path) container = portal.unrestrictedTraverse(container_path)
if container.aq_parent.meta_type != 'ERP5 Catalog': object = container._getOb(object_id) # We force access to the object to be sure
# __getitem__ on a catalog wait for an uid
object = container[object_id] # We force access to the object to be sure
# that appropriate exception is thrown # that appropriate exception is thrown
# in case object is already backup and/or removed # in case object is already backup and/or removed
if trash and trashbin is not None: if trash and trashbin is not None:
...@@ -815,7 +813,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -815,7 +813,7 @@ class ObjectTemplateItem(BaseTemplateItem):
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.getParentValue().manage_delObjects([container.id]) container.getParentValue().manage_delObjects([container.id])
except (NotFound, KeyError, BadRequest): except (NotFound, KeyError, BadRequest, AttributeError):
# object is already backup and/or removed # object is already backup and/or removed
pass pass
BaseTemplateItem.uninstall(self, context, **kw) BaseTemplateItem.uninstall(self, context, **kw)
......
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