Commit cbb6bb7d authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[Formulator] Pass through correct REQUEST inside fields and forms

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