Commit 74c66278 authored by Jérome Perrin's avatar Jérome Perrin

bug fix: do not override builtin KeyError

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6823 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4d9048c7
...@@ -705,7 +705,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -705,7 +705,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
selection = self.getSelectionFor(selection_name, REQUEST) selection = self.getSelectionFor(selection_name, REQUEST)
if selection is None: if selection is None:
selection = Selection() selection = Selection()
self.setSelectionFor(selection_name,selection, REQUEST=REQUEST) self.setSelectionFor(selection_name, selection, REQUEST=REQUEST)
if listbox_display_mode == 'FlatListMode': if listbox_display_mode == 'FlatListMode':
flat_list_mode = 1 flat_list_mode = 1
...@@ -934,7 +934,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -934,7 +934,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
if object_uid is not None: if object_uid is not None:
try : try :
o = self.portal_catalog.getObject(object_uid) o = self.portal_catalog.getObject(object_uid)
except NotFound, KeyError : except (NotFound, KeyError), err :
o = None o = None
if o is None: if o is None:
# we first try to reindex the object, thanks to the object_path # we first try to reindex the object, thanks to the object_path
...@@ -943,14 +943,14 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -943,14 +943,14 @@ class SelectionTool( UniqueObject, SimpleItem ):
if o is not None: if o is not None:
# XXX # XXX
o.immediateReindexObject() o.immediateReindexObject()
object_uid = o.getUid() object_uid = o.getUid()
else: else:
raise SelectionError, \ raise SelectionError, \
"Sorrry, Error, the calling object was not catalogued. " \ "Sorrry, Error, the calling object was not catalogued. " \
"Do not know how to do ?" "Do not know how to do ?"
# Find the field which was clicked on # Find the field which was clicked on
# Important to get from the object instead of self # Important to get from the object instead of self
form = getattr(o, form_id) form = getattr(o, form_id)
field = None field = None
# Search the correct field # Search the correct field
relation_field_found = 0 relation_field_found = 0
...@@ -959,12 +959,8 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -959,12 +959,8 @@ class SelectionTool( UniqueObject, SimpleItem ):
for field in form.get_fields(include_disabled=0): for field in form.get_fields(include_disabled=0):
if field.get_value('editable', REQUEST=REQUEST): if field.get_value('editable', REQUEST=REQUEST):
try: try:
dumb = field.get_value('is_relation_field') field.get_value('is_relation_field')
except: except KeyError:
# except KeyError:
# XXX FIXME Exception name is not in locals.
# Namespace seems a bit broken...
LOG("SelectionTool", 0, "Exception catched with broken namespace!")
pass pass
else: else:
if index == relation_index: if index == relation_index:
...@@ -975,7 +971,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -975,7 +971,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
if not relation_field_found: if not relation_field_found:
# We didn't find the field... # We didn't find the field...
raise SelectionError, "SelectionTool: can not find the relation" \ raise SelectionError, "SelectionTool: can not find the relation" \
" field %s" % index " field %s" % index
else: else:
# Field found # Field found
field_key = field.generate_field_key() field_key = field.generate_field_key()
......
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