Commit 61540fb3 authored by Romain Courteaud's avatar Romain Courteaud

Fix compatibility between ProxyField and RelationField.

Remove a possible conflict error (do not write in the ZODB if it's useless).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11658 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5720696b
...@@ -1108,7 +1108,7 @@ def Field_render_htmlgrid(self, value=None, REQUEST=None, key=None): ...@@ -1108,7 +1108,7 @@ def Field_render_htmlgrid(self, value=None, REQUEST=None, key=None):
""" """
# What about CSS ? What about description ? What about error ? # What about CSS ? What about description ? What about error ?
widget_key = self.generate_field_key(key=key) widget_key = self.generate_field_key(key=key)
value = self._get_default(key, value, REQUEST) value = self._get_default(widget_key, value, REQUEST)
__traceback_info__ = ('key=%s value=%r' % (key, value)) __traceback_info__ = ('key=%s value=%r' % (key, value))
return self.widget.render_htmlgrid(self, widget_key, value, REQUEST) return self.widget.render_htmlgrid(self, widget_key, value, REQUEST)
Field.render_htmlgrid = Field_render_htmlgrid Field.render_htmlgrid = Field_render_htmlgrid
......
...@@ -249,22 +249,14 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, ...@@ -249,22 +249,14 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
#################################### ####################################
# Render listfield # Render listfield
#################################### ####################################
tales_expr = field.tales.get('items', None)
defined_tales = 0
if not tales_expr:
defined_tales = 1
from Products.Formulator.TALESField import TALESMethod
# XXX XXX Do not write in the ZODB
field.tales['items'] = TALESMethod('REQUEST/relation_item_list')
REQUEST['relation_item_list'] = relation_item_list REQUEST['relation_item_list'] = relation_item_list
sub_html_string += ' %s ' % \ sub_html_string += ' %s ' % \
Widget.ListWidgetInstance.render( Widget.ListWidgetInstance.render(
field, relation_field_id, None, REQUEST) field, relation_field_id, None, REQUEST)
REQUEST['relation_item_list'] = None REQUEST['relation_item_list'] = None
if defined_tales:
# Delete default tales on the fly
field.tales['items'] = None
else: else:
#################################### ####################################
# Render wheel # Render wheel
...@@ -778,3 +770,17 @@ class MultiRelationStringField(ZMIField): ...@@ -778,3 +770,17 @@ class MultiRelationStringField(ZMIField):
else: else:
result = ZMIField.get_orig_value(self, id) result = ZMIField.get_orig_value(self, id)
return result return result
security.declareProtected('Access contents information', 'get_value')
def get_value(self, id, REQUEST=None, **kw):
"""Get value for id.
Optionally pass keyword arguments that get passed to TALES
expression.
"""
if (id == 'items') and (REQUEST is not None):
# relation_item_list is not editable for the RelationField
result = REQUEST.get('relation_item_list', None)
else:
result = ZMIField.get_value(self, id, **kw)
return result
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