Projet

Général

Profil

0001-misc-don-t-break-on-incomplete-ezt-for-expression-20.patch

Frédéric Péters, 24 octobre 2021 15:26

Télécharger (1,71 ko)

Voir les différences:

Subject: [PATCH] misc: don't break on incomplete ezt "for" expression (#20721)

 tests/api/test_all.py | 6 ++++++
 wcs/qommon/ezt.py     | 2 ++
 2 files changed, 8 insertions(+)
tests/api/test_all.py
100 100
    resp = get_app(pub).get('/api/validate-expression?expression={{hello+%C3%A9l%C3%A9phant}}')
101 101
    assert resp.json['klass'] == 'error'
102 102
    assert resp.json['msg'].startswith('syntax error in Django template: Could not parse the remainder')
103
    # broken ezt
104
    resp = get_app(pub).get('/api/validate-expression?expression=[for]')
105
    assert resp.json == {
106
        'klass': 'error',
107
        'msg': 'syntax error in ezt template: wrong number of arguments at line 1 and column 1',
108
    }
103 109

  
104 110

  
105 111
def test_validate_condition(pub):
wcs/qommon/ezt.py
413 413
                        raise ArgCountSyntaxError(str(args[1:]), line, column)
414 414
                    # this assumes arg1 is always a ref unless cmd is 'define'
415 415
                    if cmd != 'define':
416
                        if len(args) < 2:
417
                            raise ArgCountSyntaxError(str(args), line, column)
416 418
                        args[1] = _prepare_ref(args[1], for_names, file_args)
417 419

  
418 420
                    # handle arg2 for the 'is' command
419
-