Commit 107c6c8a authored by Romain Courteaud's avatar Romain Courteaud

Catch the error raised by portal_catalog.getObject when the uid is a string.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4356 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f55dcb87
......@@ -411,7 +411,11 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
if relation_uid not in (None, ''):
# A value has been defined by the user in popup menu
if type(relation_uid) in (type([]), type(())): relation_uid = relation_uid[0]
related_object = portal_catalog.getObject(relation_uid)
try:
related_object = portal_catalog.getObject(relation_uid)
except ValueError:
# Catch the exception raised when the uid is a string
related_object = None
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
......
......@@ -350,7 +350,11 @@ class RelationStringFieldValidator(Validator.StringValidator):
else:
relation_uid = relation_uid[0]
related_object = portal_catalog.getObject(relation_uid)
try:
related_object = portal_catalog.getObject(relation_uid)
except ValueError:
# Catch the error raised when the uid is a string
related_object = None
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
......
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