8000 fix: Remove deprecated `get_storage_class` import from `cms.utils` by fsbraun · Pull Request #8102 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: Remove deprecated get_storage_class import from cms.utils #8102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
django-4.0.txt,
django-4.1.txt,
django-4.2.txt,
django-5.0.txt
django-5.0.txt,
django-5.1.txt
]
os: [
ubuntu-20.04,
Expand All @@ -28,10 +29,14 @@ jobs:
python-version: 3.8
- requirements-file: django-5.0.txt
python-version: 3.9
- requirements-file: django-5.1.txt
python-version: 3.8
- requirements-file: django-5.1.txt
python-version: 3.9

services:
postgres:
image: postgres:12
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand Down Expand Up @@ -76,7 +81,8 @@ jobs:
django-4.0.txt,
django-4.1.txt,
django-4.2.txt,
django-5.0.txt
django-5.0.txt,
django-5.1.txt
]
os: [
ubuntu-20.04,
Expand All @@ -86,6 +92,10 @@ jobs:
python-version: 3.8
- requirements-file: django-5.0.txt
python-version: 3.9
- requirements-file: django-5.1.txt
python-version: 3.8
- requirements-file: django-5.1.txt
python-version: 3.9

services:
mysql:
Expand Down Expand Up @@ -134,7 +144,8 @@ jobs:
django-4.0.txt,
django-4.1.txt,
django-4.2.txt,
django-5.0.txt
django-5.0.txt,
django-5.1.txt
]
os: [
ubuntu-20.04,
Expand All @@ -144,6 +155,10 @@ jobs:
python-version: 3.8
- requirements-file: django-5.0.txt
python-version: 3.9
- requirements-file: django-5.1.txt
python-version: 3.8
- requirements-file: django-5.1.txt
python-version: 3.9

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions cms/models/pagemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def _update_title_path_recursive(self, language, slug=None):
base = self.get_path(language, fallback=True)

if base:
new_path = Concat(models.Value(base), models.Value('/'), models.F('slug'))
new_path = Concat(models.Value(base), models.Value('/'), models.F('slug'), output_field=models.CharField())
else:
# User is moving the homepage
new_path = models.F('slug')
Expand All @@ -386,7 +386,7 @@ def _set_title_root_path(self):
# to include this page's slug as its path prefix
(translations
.filter(language=language)
.update(path=Concat(models.Value(slug), models.Value('/'), 'path')))
.update(path=Concat(models.Value(slug), models.Value('/'), 'path', output_field=models.CharField())))

# Explicitly update this page's path to match its slug
# Doing this is cheaper than a TRIM call to remove the "/" characters
Expand Down Expand Up @@ -1190,7 +1190,7 @@ def mark_descendants_as_published(self, language):
)

if base:
new_path = Concat(models.Value(base), models.Value('/'), models.F('slug'))
new_path = Concat(models.Value(base), models.Value('/'), models.F('slug'), output_field=models.CharField())
else:
# User is moving the homepage
new_path = models.F('slug')
Expand Down
5 changes: 3 additions & 2 deletions cms/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# TODO: this is just stuff from utils.py - should be split / moved
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.utils.functional import LazyObject

from cms.utils.conf import get_site_id # nopyflakes
Expand Down Expand Up @@ -54,7 +53,9 @@ def get_language_from_request(request, current_page=None):

class ConfiguredStorage(LazyObject):
def _setup(self):
self._wrapped = get_storage_class(getattr(settings, 'STATICFILES_STORAGE', default_storage))()
from django.utils.module_loading import import_string

self._wrapped = import_string(getattr(settings, 'STATICFILES_STORAGE', default_storage))()


configured_storage = ConfiguredStorage()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ skip = package-lock.json,*.js,*.po,./node_modules/*,./.idea/*,./docs/env/*,./doc

[options]
install_requires =
Django>=3.2
Django>=3.2,<5.2
python_requires = >=3.7

2 changes: 2 additions & 0 deletions setup.py
< 629A /tr>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.1',
Expand All @@ -36,6 +37,7 @@
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
Expand Down
2 changes: 2 additions & 0 deletions test_requirements/django-5.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements_base.txt
Django>=5.1,<5.2
Loading
0