json cell: always reset json context variable (#16463)

This commit is contained in:
Thomas NOËL 2017-05-23 15:30:48 +02:00
parent 86ba3cbb4a
commit bac05b0cd7
2 changed files with 2 additions and 1 deletions

View File

@ -829,6 +829,7 @@ class JsonCellBase(CellBase):
if varname in context['request'].GET and varname not in context:
context[varname] = context['request'].GET[varname]
self._json_content = None
extra_context['json'] = None
try:
url = utils.get_templated_url(self.url, context)
except utils.UnknownTemplateVariableError:

View File

@ -200,7 +200,7 @@ def test_json_cell():
with mock.patch('combo.utils.requests.get') as requests_get:
context = cell.get_cell_extra_context(Context({}))
# can't get URL, 'foobar' variable is missing
assert 'json' not in context
assert context['json'] == None
assert requests_get.call_count == 0
request = RequestFactory().get('/')
request.user = User(username='foo', email='foo@example.net')