Commit e5c3b2f5 authored by Tomáš Peterka's avatar Tomáš Peterka

[Formulator] Pass through correct REQUEST inside fields and forms

parent 59444238
......@@ -80,6 +80,8 @@ class EditorWidget(Widget.TextAreaWidget):
"""
Render editor
"""
if REQUEST is None:
REQUEST = get_request()
here = REQUEST['here']
text_editor = field.get_value('text_editor')
if text_editor == "svg_editor":
......
......@@ -263,7 +263,7 @@ class DefaultValue(StaticValue):
self.value = value
def __call__(self, field, id, **kw):
REQUEST = get_request()
REQUEST = kw.get('REQUEST', None) or get_request()
try:
form = field.aq_parent
ob = REQUEST.get('cell', getattr(form, 'aq_parent', None))
......@@ -278,7 +278,6 @@ class DefaultValue(StaticValue):
value = ob.getProperty(self.key)
except Unauthorized:
value = ob.getProperty(self.key, d=value, checked_permission='View')
REQUEST = kw.get('REQUEST', get_request())
if REQUEST is not None:
REQUEST.set('read_only_%s' % self.key, 1)
except (KeyError, AttributeError):
......
......@@ -730,6 +730,7 @@ class TestListBox(ERP5TypeTestCase):
"""
portal = self.getPortal()
request = get_request()
request['here'] = portal.foo_module
portal.ListBoxZuite_reset()
form = portal.FooModule_viewFooList
self.assertEqual(None, request.get('listbox_form_id'))
......
......@@ -111,6 +111,7 @@ class Field:
# add 'here' if not in kw
if not kw.has_key('here'):
kw['here'] = self.aq_parent
if not kw.has_key('request'):
kw['request'] = self.REQUEST
value = tales_expr.__of__(self)(
field=self,
......
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