Commit 6222335b authored by Jérome Perrin's avatar Jérome Perrin

ERP5Form: fix `cell` in Matrixbox TALES context

TALESValue always had a strange behavior of setting the request as `cell` when
rendering a matrixbox in the case where there was no cell at the given
coordinates, but this code was not used, becase the request was not passed in
kw. When in 777c5e6c ([ERP5Form] Pass request to fields, 2017-12-29) we
changed to always pass the request, this changed the behavior. After this
change when there was no matrix cell, in the TALES context the variable `cell`
became request.

This restore the original behavior (cell being the cell or None), by changing
the questionable code that was not used before.
parent a1fee3fc
Pipeline #16215 failed with stage
in 0 seconds
...@@ -213,10 +213,7 @@ class TALESValue(StaticValue): ...@@ -213,10 +213,7 @@ class TALESValue(StaticValue):
if kw.get('cell') is None: if kw.get('cell') is None:
request = kw.get('REQUEST') request = kw.get('REQUEST')
if request is not None: if request is not None:
if getattr(request, 'cell', None) is not None: kw['cell'] = getattr(request, 'cell', None)
kw['cell'] = request.cell
else:
kw['cell'] = request
if 'cell_index' not in kw and\ if 'cell_index' not in kw and\
getattr(request, 'cell_index', None) is not None: getattr(request, 'cell_index', None) is not None:
kw['cell_index'] = request.cell_index kw['cell_index'] = request.cell_index
......
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