misc: don't break on incomplete ezt "for" expression (#20721)
This commit is contained in:
parent
502643aa2e
commit
74f6f5a014
|
@ -100,6 +100,12 @@ def test_validate_expression(pub):
|
|||
resp = get_app(pub).get('/api/validate-expression?expression={{hello+%C3%A9l%C3%A9phant}}')
|
||||
assert resp.json['klass'] == 'error'
|
||||
assert resp.json['msg'].startswith('syntax error in Django template: Could not parse the remainder')
|
||||
# broken ezt
|
||||
resp = get_app(pub).get('/api/validate-expression?expression=[for]')
|
||||
assert resp.json == {
|
||||
'klass': 'error',
|
||||
'msg': 'syntax error in ezt template: wrong number of arguments at line 1 and column 1',
|
||||
}
|
||||
|
||||
|
||||
def test_validate_condition(pub):
|
||||
|
|
|
@ -413,6 +413,8 @@ class Template:
|
|||
raise ArgCountSyntaxError(str(args[1:]), line, column)
|
||||
# this assumes arg1 is always a ref unless cmd is 'define'
|
||||
if cmd != 'define':
|
||||
if len(args) < 2:
|
||||
raise ArgCountSyntaxError(str(args), line, column)
|
||||
args[1] = _prepare_ref(args[1], for_names, file_args)
|
||||
|
||||
# handle arg2 for the 'is' command
|
||||
|
|
Loading…
Reference in New Issue