Skip to content

Commit

Permalink
Fix django.utils.encoding.force_text and django.conf.urls for Django4
Browse files Browse the repository at this point in the history
support
  • Loading branch information
terada-mariana committed Jan 24, 2022
1 parent 72f965d commit ef57f8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions django_gcloud_storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.core.files.base import File
from django.core.files.storage import Storage
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text, smart_str
from django.utils.encoding import force_str, smart_str
from google.cloud import _helpers as gcloud_helpers
from google.cloud import storage
from google.cloud.exceptions import NotFound
Expand All @@ -24,8 +24,8 @@


def safe_join(base, path):
base = force_text(base).replace("\\", "/").lstrip("/").rstrip("/") + "/"
path = force_text(path).replace("\\", "/").lstrip("/")
base = force_str(base).replace("\\", "/").lstrip("/").rstrip("/") + "/"
path = force_str(path).replace("\\", "/").lstrip("/")

# Ugh... there must be a better way that I can't think of right now
if base == "/":
Expand Down
8 changes: 4 additions & 4 deletions test_app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url
from django.urls import re_path
from django.views.generic.base import TemplateView

from test_app.app import views

urlpatterns = [
url(r'^upload$', views.TestUploadView.as_view()),
url(r'^upload/success',
re_path(r'^upload$', views.TestUploadView.as_view()),
re_path(r'^upload/success',
TemplateView.as_view(template_name="success.html"),
name='upload_success'),
url(r'^file/(?P<id>[0-9]+)$', views.file),
re_path(r'^file/(?P<id>[0-9]+)$', views.file),
]

0 comments on commit ef57f8c

Please sign in to comment.