Commit 6ad1e978 authored by Yoshinori Okuji's avatar Yoshinori Okuji

When a field cannot be obtained, log a warning message and return an empty...

When a field cannot be obtained, log a warning message and return an empty string instead of raising an exception.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5482 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c9004080
No related merge requests found
......@@ -42,7 +42,7 @@ from Products.PythonScripts.standard import url_quote_plus
import string
from zLOG import LOG
from zLOG import LOG, WARNING
class ProxyWidget(Widget.Widget):
"""
......@@ -95,8 +95,12 @@ class ProxyWidget(Widget.Widget):
Render proxy field
"""
form = field.aq_parent
proxy_form = getattr(form, field.get_value('form_id'))
proxy_field = getattr(proxy_form, field.get_value('field_id'))
try:
proxy_form = getattr(form, field.get_value('form_id'))
proxy_field = getattr(proxy_form, field.get_value('field_id'))
except AttributeError:
LOG('ProxyField', WARNING, 'could not get a field from a proxy field %s in %s' % (field.id, form.id))
return ''
extra_context = REQUEST.get('erp5_extra_context', {})
for k, v in field.get_value('extra_context'):
extra_context[k] = v
......@@ -108,8 +112,12 @@ class ProxyWidget(Widget.Widget):
Display proxy field
"""
form = field.aq_parent
proxy_form = getattr(form, field.get_value('form_id'))
proxy_field = getattr(proxy_form, field.get_value('field_id'))
try:
proxy_form = getattr(form, field.get_value('form_id'))
proxy_field = getattr(proxy_form, field.get_value('field_id'))
except AttributeError:
LOG('ProxyField', WARNING, 'could not get a field from a proxy field %s in %s' % (field.id, form.id))
return ''
REQUEST = get_request()
extra_context = REQUEST.get('erp5_extra_context', {})
for k, v in field.get_value('extra_context'):
......
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