Commit 0a0905ae authored by Yoshinori Okuji's avatar Yoshinori Okuji

Use REQUEST.other instead of REQUEST itself.

Pass the extra context in the validator as well.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5506 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62ec9a3e
......@@ -78,7 +78,7 @@ def get_value(self, id, **kw):
except AttributeError :
LOG('ERP5Form', 0,
'portal_preferences not put in TALES context (not installed?)')
extra_context = REQUEST.get('erp5_extra_context', None)
extra_context = REQUEST.other.get('erp5_extra_context', None)
if extra_context:
kw.update(extra_context)
# This allows to pass some pointer to the local object
......
......@@ -101,10 +101,10 @@ class ProxyWidget(Widget.Widget):
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', {})
extra_context = REQUEST.other.get('erp5_extra_context', {})
for k, v in field.get_value('extra_context'):
extra_context[k] = v
REQUEST['erp5_extra_context'] = extra_context
REQUEST.other['erp5_extra_context'] = extra_context
return proxy_field.widget.render(proxy_field, key, value, REQUEST)
def render_view(self, field, value):
......@@ -119,10 +119,10 @@ class ProxyWidget(Widget.Widget):
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', {})
extra_context = REQUEST.other.get('erp5_extra_context', {})
for k, v in field.get_value('extra_context'):
extra_context[k] = v
REQUEST['erp5_extra_context'] = extra_context
REQUEST.other['erp5_extra_context'] = extra_context
return proxy_field.widget.render_view(proxy_field, key, value)
......@@ -136,6 +136,10 @@ class ProxyValidator(Validator.Validator):
form = field.aq_parent
proxy_form = getattr(form, field.get_value('form_id'))
proxy_field = getattr(proxy_form, field.get_value('field_id'))
extra_context = REQUEST.other.get('erp5_extra_context', {})
for k, v in field.get_value('extra_context'):
extra_context[k] = v
REQUEST.other['erp5_extra_context'] = extra_context
try:
result = proxy_field.validator.validate(proxy_field, key, REQUEST)
except ValidationError, error:
......
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