0001-misc-do-not-announce-invalid-varnames-as-ok-60675.patch
tests/test_formdata.py | ||
---|---|---|
3276 | 3276 |
tmpl = Template('{{ form_var_block|getlist:"foo"|sum }} {{ form_var_block|getlist:"bar"|sum }}') |
3277 | 3277 |
assert tmpl.render(context) == '9 2' |
3278 | 3278 | |
3279 |
# check invalid varname are ignored (should not happen) |
|
3280 |
block.fields[0].varname = 'foo-bar' |
|
3281 |
block.store() |
|
3282 |
formdef.refresh_from_storage() |
|
3283 |
formdata = formdef.data_class().get(formdata.id) |
|
3284 |
variables = formdata.get_substitution_variables() |
|
3285 |
assert 'form_var_block_0_foo-bar' not in variables.get_flat_keys() |
|
3286 | ||
3279 | 3287 | |
3280 | 3288 |
def test_block_with_empty_digest_variable(pub): |
3281 | 3289 |
BlockDef.wipe() |
wcs/variables.py | ||
---|---|---|
678 | 678 |
return self._varnames |
679 | 679 |
self._varnames = {} |
680 | 680 |
for field in self._fields: |
681 |
if not field.varname: |
|
681 |
if not field.varname or not CompatibilityNamesDict.valid_key_regex.match(field.varname):
|
|
682 | 682 |
continue |
683 | 683 |
if field.varname in self._varnames: |
684 | 684 |
# duplicated varname |
685 |
- |