Commit 4e5700a5 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Eteri

[ERP5Form] Field.render passes extra arguments so user-defined fields can have richer rendering

parent 72c6e206
...@@ -194,7 +194,7 @@ class Field: ...@@ -194,7 +194,7 @@ class Field:
return "Unknown error: %s" % name return "Unknown error: %s" % name
security.declarePrivate('_render_helper') security.declarePrivate('_render_helper')
def _render_helper(self, key, value, REQUEST, render_prefix=None, editable=None): def _render_helper(self, key, value, REQUEST, render_prefix=None, editable=None, **kw):
value = self._get_default(key, value, REQUEST) value = self._get_default(key, value, REQUEST)
__traceback_info__ = ('key=%s value=%r' % (key, value)) __traceback_info__ = ('key=%s value=%r' % (key, value))
if self.get_value('hidden', REQUEST=REQUEST): if self.get_value('hidden', REQUEST=REQUEST):
...@@ -204,10 +204,10 @@ class Field: ...@@ -204,10 +204,10 @@ class Field:
editable = self.get_value('editable', REQUEST=REQUEST) editable = self.get_value('editable', REQUEST=REQUEST)
if not editable: if not editable:
return self.widget.render_view(self, value, REQUEST=REQUEST, return self.widget.render_view(self, value, REQUEST=REQUEST,
render_prefix=render_prefix) render_prefix=render_prefix, **kw)
else: else:
return self.widget.render(self, key, value, REQUEST, return self.widget.render(self, key, value, REQUEST,
render_prefix=render_prefix) render_prefix=render_prefix, **kw)
security.declarePrivate('_render_odt_helper') security.declarePrivate('_render_odt_helper')
def _render_odt_helper(self, key, value, as_string, ooo_builder, def _render_odt_helper(self, key, value, as_string, ooo_builder,
...@@ -261,7 +261,7 @@ class Field: ...@@ -261,7 +261,7 @@ class Field:
return REQUEST.form[key] return REQUEST.form[key]
security.declareProtected('View', 'render') security.declareProtected('View', 'render')
def render(self, value=None, REQUEST=None, key=None, render_prefix=None, key_prefix=None, editable=None): def render(self, value=None, REQUEST=None, key=None, render_prefix=None, key_prefix=None, editable=None, **kw):
"""Render the field widget. """Render the field widget.
value -- the value the field should have (for instance value -- the value the field should have (for instance
from validation). from validation).
...@@ -279,6 +279,7 @@ class Field: ...@@ -279,6 +279,7 @@ class Field:
REQUEST, REQUEST,
render_prefix=render_prefix, render_prefix=render_prefix,
editable=editable, editable=editable,
**kw
) )
security.declareProtected('View', 'render_view') security.declareProtected('View', 'render_view')
......
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