Skip to content

Commit

Permalink
Merge pull request #4703 from open-formulieren/tool/add-script-to-fix…
Browse files Browse the repository at this point in the history
…-globalconfig

Add script to fix globalconfig
  • Loading branch information
sergei-maertens authored Sep 24, 2024
2 parents 4bd7d60 + e066bd1 commit a99638a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ COPY \
./bin/report_component_problems.py \
./bin/check_objecttype_urls.py \
./bin/check_zgw_groups.py \
./bin/fix_globalconfig_zip.py \
./bin/

# prevent writing to the container layer, which would degrade performance.
Expand Down
30 changes: 30 additions & 0 deletions bin/fix_globalconfig_zip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
import sys
from pathlib import Path

import django

SRC_DIR = Path(__file__).parent.parent / "src"
sys.path.insert(0, str(SRC_DIR.resolve()))


def main() -> None:
from openforms.setup import setup_env

setup_env()
django.setup()

from openforms.config.constants import UploadFileType
from openforms.config.models import GlobalConfiguration

config = GlobalConfiguration.get_solo()
if "application/zip" not in config.form_upload_default_file_types:
return

config.form_upload_default_file_types.remove("application/zip")
config.form_upload_default_file_types.append(UploadFileType.zip)
config.save(update_fields=("form_upload_default_file_types",))


if __name__ == "__main__":
main()

0 comments on commit a99638a

Please sign in to comment.