Skip to content

Commit a67425f

Browse files
Fix broken field initialization
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
1 parent 0e03033 commit a67425f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/onegov/swissvotes/fields/metadata.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def __init__(
5050
depends_on: Sequence[Any] | None = None,
5151
pricing: PricingRules | None = None,
5252
) -> None:
53-
kwargs: dict[str, Any] = {}
54-
kwargs.setdefault('validators', [])
55-
kwargs['allowed_mimetypes'] = {
53+
allowed_mimetypes = {
5654
'application/excel',
5755
'application/octet-stream',
5856
'application/vnd.ms-excel',
@@ -63,20 +61,18 @@ def __init__(
6361
),
6462
'application/zip'
6563
}
66-
kwargs['validators'].append(FileSizeLimit(10 * 1024 * 1024))
67-
kwargs.setdefault('render_kw', {})
68-
kwargs['render_kw']['force_simple'] = True
6964

7065
super().__init__(
7166
label=label,
72-
validators=validators,
67+
validators=[*(validators or ()), FileSizeLimit(10 * 1024 * 1024)],
7368
filters=filters,
7469
description=description,
7570
id=id,
7671
default=default,
7772
widget=widget,
78-
render_kw=render_kw,
73+
render_kw={**(render_kw or {}), 'force_simple': True},
7974
name=name,
75+
allowed_mimetypes=allowed_mimetypes,
8076
_form=_form,
8177
_prefix=_prefix,
8278
_translations=_translations,

0 commit comments

Comments
 (0)