From 837b82e847c301c372ea6e8ef0dd038c1ccf4489 Mon Sep 17 00:00:00 2001 From: meteogrid Date: Thu, 12 Mar 2026 18:21:06 +0000 Subject: [PATCH 1/8] django 5 --- filebrowser_safe/views.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/filebrowser_safe/views.py b/filebrowser_safe/views.py index f202242..1664254 100644 --- a/filebrowser_safe/views.py +++ b/filebrowser_safe/views.py @@ -2,7 +2,7 @@ import re from json import dumps -from django import forms +from django import forms, get_version from django.conf import settings as django_settings from django.contrib import messages from django.contrib.admin.views.decorators import staff_member_required @@ -39,20 +39,23 @@ try: from mezzanine.utils.html import escape except ImportError: - escape = lambda s: s # noqa - + def escape(s): return s # noqa +if get_version() > '4': + DEFAULT_FILE_STORAGE = django_settings.STORAGES['default']['BACKEND'] +else: + DEFAULT_FILE_STORAGE = django_settings.DEFAULT_FILE_STORAGE # Add some required methods to FileSystemStorage -storage_class_name = django_settings.DEFAULT_FILE_STORAGE.split(".")[-1] +storage_class_name = DEFAULT_FILE_STORAGE.split(".")[-1] mixin_class_name = "filebrowser_safe.storage.%sMixin" % storage_class_name # Workaround for django-s3-folder-storage -if django_settings.DEFAULT_FILE_STORAGE == "s3_folder_storage.s3.DefaultStorage": +if DEFAULT_FILE_STORAGE == "s3_folder_storage.s3.DefaultStorage": mixin_class_name = "filebrowser_safe.storage.S3BotoStorageMixin" try: mixin_class = import_string(mixin_class_name) - storage_class = import_string(django_settings.DEFAULT_FILE_STORAGE) + storage_class = import_string(DEFAULT_FILE_STORAGE) except ImportError: pass else: From f2152c504b1e50e47a19060cc3237eb60fcab351 Mon Sep 17 00:00:00 2001 From: meteogrid Date: Thu, 12 Mar 2026 18:21:06 +0000 Subject: [PATCH 2/8] django 5 --- .github/workflows/main.yml | 69 ++++++++++---------------------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2b0a55..a8f2289 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,55 +14,22 @@ jobs: fail-fast: false matrix: include: - # Django 2.2 - - tox-env: "py36-dj22" - python-version: "3.6" - - tox-env: "py37-dj22" - python-version: "3.7" - - tox-env: "py38-dj22" - python-version: "3.8" - - tox-env: "py39-dj22" - python-version: "3.9" - # Django 3.0 - - tox-env: "py36-dj30" - python-version: "3.6" - - tox-env: "py37-dj30" - python-version: "3.7" - - tox-env: "py38-dj30" - python-version: "3.8" - - tox-env: "py39-dj30" - python-version: "3.9" - # Django 3.1 - - tox-env: "py36-dj31" - python-version: "3.6" - - tox-env: "py37-dj31" - python-version: "3.7" - - tox-env: "py38-dj31" - python-version: "3.8" - - tox-env: "py39-dj31" - python-version: "3.9" - # Django 3.2 - - tox-env: "py36-dj32" - python-version: "3.6" - - tox-env: "py37-dj32" - python-version: "3.7" - - tox-env: "py38-dj32" - python-version: "3.8" - - tox-env: "py39-dj32" - python-version: "3.9" - - tox-env: "py310-dj32" - python-version: "3.10" - # Django 4.0 - - tox-env: "py38-dj40" - python-version: "3.8" - - tox-env: "py39-dj40" - python-version: "3.9" - - tox-env: "py310-dj40" + # Django 5.2 + - tox-env: "py310-dj52" python-version: "3.10" + # Django 5.2 + - tox-env: "py311-dj52" + python-version: "3.11" + # Django 5.2 + - tox-env: "py312-dj52" + python-version: "3.12" + # Django 5.2 + - tox-env: "py313-dj52" + python-version: "3.13" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -78,8 +45,8 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v6 with: python-version: 3.9 - name: Install dependencies @@ -94,10 +61,10 @@ jobs: needs: [test, lint] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v6 with: - python-version: 3.9 + python-version: 3.10 - uses: actions/setup-node@v2 with: node-version: '14' # https://github.com/cycjimmy/semantic-release-action/issues/79#issuecomment-955463633 From 1434a9878e149fa01a5b8830e04daf0761713600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20S=C3=A1nchez=20Provencio?= Date: Mon, 16 Mar 2026 08:37:59 +0100 Subject: [PATCH 3/8] wip --- setup.cfg | 17 ++++++++--------- tox.ini | 8 ++------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/setup.cfg b/setup.cfg index fa27b12..f0eaa8b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,14 +13,13 @@ license_file = LICENSE classifiers = Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 [options] -python_requires = >=3.6 +python_requires = >=3.10 packages = find: include_package_data = true @@ -29,10 +28,10 @@ testing = pytest-django >= 4, <5 pytest-cov >= 2, < 3 codestyle = - flake8 >= 3, <4 - black==20.8b1 - isort >= 5, <6 - pyupgrade >= 2, <3 + flake8 >= 7, <8 + black==26.3.1 + isort >= 8, <9 + pyupgrade >= 3, <4 # Building diff --git a/tox.ini b/tox.ini index ab4ea0c..49f7774 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{36,37,38,39,310}-dj{22,30,31,32,40} + py{310,311,312,313}-dj{52} package lint @@ -9,11 +9,7 @@ envlist = usedevelop = true deps = .[testing] - dj22: Django>=2.2, <3 - dj30: Django>=3.0, <3.1 - dj31: Django>=3.1, <3.2 - dj32: Django>=3.2, <3.3 - dj40: Django>=4.0, <4.1 + dj52: Django>=5.2, <5.3 commands = pytest --basetemp="{envtmpdir}" --junitxml="junit/TEST-{envname}.xml" {posargs} From 115980ca86296c3b32a902bfa1dad7e686d2c660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20S=C3=A1nchez=20Provencio?= Date: Mon, 16 Mar 2026 08:43:13 +0100 Subject: [PATCH 4/8] wip --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a8f2289..726a8d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: python-version: "3.13" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} @@ -45,7 +45,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.9 @@ -61,14 +61,14 @@ jobs: needs: [test, lint] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.10 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v6 with: node-version: '14' # https://github.com/cycjimmy/semantic-release-action/issues/79#issuecomment-955463633 - - uses: cycjimmy/semantic-release-action@v2 + - uses: cycjimmy/semantic-release-action@v6 with: semantic_version: 18 extra_plugins: | From f55d5aad9bb0a7558bb3f1c45d1d1c65b58aca1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20S=C3=A1nchez=20Provencio?= Date: Mon, 16 Mar 2026 08:46:25 +0100 Subject: [PATCH 5/8] wip --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 726a8d8..b990d28 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: 3.9 + python-version: 3.10 - name: Install dependencies run: pip install tox -U pip - name: Lint From 9cea4a41f7a3210de2ce988d6e7dc874f9fc3cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20S=C3=A1nchez=20Provencio?= Date: Mon, 16 Mar 2026 09:00:14 +0100 Subject: [PATCH 6/8] wip --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b990d28..8d0144a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: - name: Run tests run: tox -e ${{ matrix.tox-env }} - name: Publish Test Report - uses: mikepenz/action-junit-report@v2 + uses: mikepenz/action-junit-report@v6 with: report_paths: '**/junit/TEST-*.xml' From 6ce07be9ad60e99e64f5bc231a69312a4e71638d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20S=C3=A1nchez=20Provencio?= Date: Mon, 16 Mar 2026 09:53:28 +0100 Subject: [PATCH 7/8] wip --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d0144a..c8e091a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: 3.10 + python-version: "3.10" - name: Install dependencies run: pip install tox -U pip - name: Lint @@ -64,7 +64,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: 3.10 + python-version: "3.10" - uses: actions/setup-node@v6 with: node-version: '14' # https://github.com/cycjimmy/semantic-release-action/issues/79#issuecomment-955463633 From 119a0aba9ce99956096bed562e8e2a02d7b4b0c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20S=C3=A1nchez=20Provencio?= Date: Mon, 16 Mar 2026 10:07:38 +0100 Subject: [PATCH 8/8] black --- filebrowser_safe/functions.py | 6 ++---- filebrowser_safe/templatetags/fb_tags.py | 6 ++---- filebrowser_safe/views.py | 13 ++++++++----- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/filebrowser_safe/functions.py b/filebrowser_safe/functions.py index 783299a..a6f6d8b 100644 --- a/filebrowser_safe/functions.py +++ b/filebrowser_safe/functions.py @@ -18,13 +18,11 @@ # For now we just want to be able tu run the test suite without having mezzanine # installed, and this will do. Remove once filebrowser-safe is completely decoupled # from mezzanine. - warnings.warn( - """ + warnings.warn(""" You are using a placeholder implementation of the current_site_id function intended for test purposes only. If you're seeing this you might have a problem with your Mezzanine installation. - """ - ) + """) def current_site_id(): return dj_settings.SITE_ID diff --git a/filebrowser_safe/templatetags/fb_tags.py b/filebrowser_safe/templatetags/fb_tags.py index 9d478ee..ecc4894 100644 --- a/filebrowser_safe/templatetags/fb_tags.py +++ b/filebrowser_safe/templatetags/fb_tags.py @@ -17,13 +17,11 @@ # For now we just want to be able tu run the test suite without having mezzanine # installed, and this will do. Remove once filebrowser-safe is completely decoupled # from mezzanine. - warnings.warn( - """ + warnings.warn(""" You are using a placeholder implementation of the thumbnail tag intended for test purposes only. If you're seeing this you might have a problem with your Mezzanine installation. - """ - ) + """) def thumbnail(image_url, *args, **kwargs): return image_url diff --git a/filebrowser_safe/views.py b/filebrowser_safe/views.py index 1664254..6f88684 100644 --- a/filebrowser_safe/views.py +++ b/filebrowser_safe/views.py @@ -39,10 +39,13 @@ try: from mezzanine.utils.html import escape except ImportError: - def escape(s): return s # noqa -if get_version() > '4': - DEFAULT_FILE_STORAGE = django_settings.STORAGES['default']['BACKEND'] + def escape(s): + return s # noqa + + +if get_version() > "4": + DEFAULT_FILE_STORAGE = django_settings.STORAGES["default"]["BACKEND"] else: DEFAULT_FILE_STORAGE = django_settings.DEFAULT_FILE_STORAGE # Add some required methods to FileSystemStorage @@ -278,7 +281,7 @@ def mkdir(request): ) return HttpResponseRedirect(redirect_url) except OSError as xxx_todo_changeme: - (errno, strerror) = xxx_todo_changeme.args + errno, strerror = xxx_todo_changeme.args if errno == 13: form.errors["dir_name"] = forms.utils.ErrorList( [_("Permission denied.")] @@ -558,7 +561,7 @@ def rename(request): ) return HttpResponseRedirect(redirect_url) except OSError as xxx_todo_changeme1: - (errno, strerror) = xxx_todo_changeme1.args + errno, strerror = xxx_todo_changeme1.args form.errors["name"] = forms.util.ErrorList([_("Error.")]) else: file_basename = os.path.splitext(filename)[0]