Commit bb44ccc3 authored by Jérome Perrin's avatar Jérome Perrin

Catch errors on portal_catalog.getObject failures


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4396 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef05ddc4
......@@ -27,6 +27,7 @@
##############################################################################
import string, types, sys
from OFS.Traversable import NotFound
from AccessControl import ClassSecurityInfo
from Products.Formulator.DummyField import fields
from Products.Formulator import Widget, Validator
......@@ -2087,7 +2088,10 @@ class ListBoxValidator(Validator.Validator):
if 1: #try:
# We must try this
# because sometimes, we can be provided bad uids
o = here.portal_catalog.getObject(uid)
try :
o = here.portal_catalog.getObject(uid)
except KeyError, NotFound:
o = None
if o is None:
# It is possible that this object is not catalogged yet. So
# the object must be obtained from ZODB.
......
......@@ -30,6 +30,7 @@
ERP portal_selection tool.
"""
from OFS.Traversable import NotFound
from OFS.SimpleItem import SimpleItem
from Products.CMFCore.utils import UniqueObject
from Globals import InitializeClass, DTMLFile, PersistentMapping, get_request
......@@ -915,10 +916,10 @@ class SelectionTool( UniqueObject, SimpleItem ):
object_uid = REQUEST.get('object_uid', None)
object_path = REQUEST.get('object_path', None)
if object_uid is not None:
o = self.portal_catalog.getObject(object_uid)
else:
o = None
try :
o = self.portal_catalog.getObject(object_uid)
except NotFound, KeyError :
o = None
if o is None:
# we first try to reindex the object, thanks to the object_path
if object_path is not None:
......
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