diff options
author | luxagraf <sng@luxagraf.net> | 2022-02-13 16:48:54 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2022-02-13 16:48:54 -0500 |
commit | 26a2d4a684db273ff707428e36911741a37532f2 (patch) | |
tree | 4f9c3665199516378aedd409aa896e7eb909fde4 /app/lib/django_comments | |
parent | 26c7400f5651d36b84adb3971c09dcc0b275b004 (diff) |
main: updated to django 4.0
Diffstat (limited to 'app/lib/django_comments')
-rw-r--r-- | app/lib/django_comments/abstracts.py | 2 | ||||
-rw-r--r-- | app/lib/django_comments/admin.py | 2 | ||||
-rw-r--r-- | app/lib/django_comments/managers.py | 4 | ||||
-rw-r--r-- | app/lib/django_comments/models.py | 2 | ||||
-rw-r--r-- | app/lib/django_comments/moderation.py | 2 | ||||
-rw-r--r-- | app/lib/django_comments/signals.py | 7 | ||||
-rw-r--r-- | app/lib/django_comments/templatetags/comments.py | 4 | ||||
-rw-r--r-- | app/lib/django_comments/urls.py | 20 | ||||
-rw-r--r-- | app/lib/django_comments/views/utils.py | 4 |
9 files changed, 24 insertions, 23 deletions
diff --git a/app/lib/django_comments/abstracts.py b/app/lib/django_comments/abstracts.py index e74ea02..5428f1a 100644 --- a/app/lib/django_comments/abstracts.py +++ b/app/lib/django_comments/abstracts.py @@ -9,7 +9,7 @@ from django.utils.html import mark_safe from django.db import models from django.utils import timezone from six import python_2_unicode_compatible -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ try: from django.urls import reverse except ImportError: diff --git a/app/lib/django_comments/admin.py b/app/lib/django_comments/admin.py index 8451c70..6a1f5f8 100644 --- a/app/lib/django_comments/admin.py +++ b/app/lib/django_comments/admin.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.contrib import admin from django.contrib.auth import get_user_model -from django.utils.translation import ugettext_lazy as _, ungettext +from django.utils.translation import gettext_lazy as _, ngettext from django_comments import get_model from django_comments.views.moderation import perform_flag, perform_approve, perform_delete diff --git a/app/lib/django_comments/managers.py b/app/lib/django_comments/managers.py index 9e1fc77..33d9e2a 100644 --- a/app/lib/django_comments/managers.py +++ b/app/lib/django_comments/managers.py @@ -1,6 +1,6 @@ from django.db import models from django.contrib.contenttypes.models import ContentType -from django.utils.encoding import force_text +from django.utils.encoding import force_str class CommentManager(models.Manager): @@ -18,5 +18,5 @@ class CommentManager(models.Manager): ct = ContentType.objects.get_for_model(model) qs = self.get_queryset().filter(content_type=ct) if isinstance(model, models.Model): - qs = qs.filter(object_pk=force_text(model._get_pk_val())) + qs = qs.filter(object_pk=force_str(model._get_pk_val())) return qs diff --git a/app/lib/django_comments/models.py b/app/lib/django_comments/models.py index 204cf2e..6eac46b 100644 --- a/app/lib/django_comments/models.py +++ b/app/lib/django_comments/models.py @@ -2,7 +2,7 @@ from six import python_2_unicode_compatible from django.conf import settings from django.db import models from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .abstracts import ( COMMENT_MAX_LENGTH, BaseCommentAbstractModel, CommentAbstractModel, diff --git a/app/lib/django_comments/moderation.py b/app/lib/django_comments/moderation.py index 3e5c412..39ac356 100644 --- a/app/lib/django_comments/moderation.py +++ b/app/lib/django_comments/moderation.py @@ -62,7 +62,7 @@ from django.core.mail import send_mail from django.db.models.base import ModelBase from django.template import loader from django.utils import timezone -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ import django_comments from django_comments import signals diff --git a/app/lib/django_comments/signals.py b/app/lib/django_comments/signals.py index 079afaf..3aac192 100644 --- a/app/lib/django_comments/signals.py +++ b/app/lib/django_comments/signals.py @@ -9,13 +9,14 @@ from django.dispatch import Signal # discarded and a 400 response. This signal is sent at more or less # the same time (just before, actually) as the Comment object's pre-save signal, # except that the HTTP request is sent along with this signal. -comment_will_be_posted = Signal(providing_args=["comment", "request"]) + +comment_will_be_posted = Signal() # providing_args=["comment", "request"] # Sent just after a comment was posted. See above for how this differs # from the Comment object's post-save signal. -comment_was_posted = Signal(providing_args=["comment", "request"]) +comment_was_posted = Signal() # providing_args=["comment", "request"] # Sent after a comment was "flagged" in some way. Check the flag to see if this # was a user requesting removal of a comment, a moderator approving/removing a # comment, or some other custom user flag. -comment_was_flagged = Signal(providing_args=["comment", "flag", "created", "request"]) +comment_was_flagged = Signal() # providing_args=["comment", "flag", "created", "request"] diff --git a/app/lib/django_comments/templatetags/comments.py b/app/lib/django_comments/templatetags/comments.py index 9b2d1a4..440a8f6 100644 --- a/app/lib/django_comments/templatetags/comments.py +++ b/app/lib/django_comments/templatetags/comments.py @@ -3,7 +3,7 @@ from django.template.loader import render_to_string from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.contrib.sites.shortcuts import get_current_site -from django.utils.encoding import smart_text +from django.utils.encoding import smart_str import django_comments @@ -85,7 +85,7 @@ class BaseCommentNode(template.Node): qs = self.comment_model.objects.filter( content_type=ctype, - object_pk=smart_text(object_pk), + object_pk=smart_str(object_pk), site__pk=site_id, ) diff --git a/app/lib/django_comments/urls.py b/app/lib/django_comments/urls.py index 45599dc..47d5b48 100644 --- a/app/lib/django_comments/urls.py +++ b/app/lib/django_comments/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.urls import path, re_path from django.contrib.contenttypes.views import shortcut from .views.comments import post_comment, comment_done @@ -8,14 +8,14 @@ from .views.moderation import ( urlpatterns = [ - url(r'^post/$', post_comment, name='comments-post-comment'), - url(r'^posted/$', comment_done, name='comments-comment-done'), - url(r'^flag/(\d+)/$', flag, name='comments-flag'), - url(r'^flagged/$', flag_done, name='comments-flag-done'), - url(r'^delete/(\d+)/$', delete, name='comments-delete'), - url(r'^deleted/$', delete_done, name='comments-delete-done'), - url(r'^approve/(\d+)/$', approve, name='comments-approve'), - url(r'^approved/$', approve_done, name='comments-approve-done'), + re_path(r'^post/$', post_comment, name='comments-post-comment'), + re_path(r'^posted/$', comment_done, name='comments-comment-done'), + re_path(r'^flag/(\d+)/$', flag, name='comments-flag'), + re_path(r'^flagged/$', flag_done, name='comments-flag-done'), + re_path(r'^delete/(\d+)/$', delete, name='comments-delete'), + re_path(r'^deleted/$', delete_done, name='comments-delete-done'), + re_path(r'^approve/(\d+)/$', approve, name='comments-approve'), + re_path(r'^approved/$', approve_done, name='comments-approve-done'), - url(r'^cr/(\d+)/(.+)/$', shortcut, name='comments-url-redirect'), + re_path(r'^cr/(\d+)/(.+)/$', shortcut, name='comments-url-redirect'), ] diff --git a/app/lib/django_comments/views/utils.py b/app/lib/django_comments/views/utils.py index a5f5c11..793fc43 100644 --- a/app/lib/django_comments/views/utils.py +++ b/app/lib/django_comments/views/utils.py @@ -12,7 +12,7 @@ except ImportError: # Python 2 from django.http import HttpResponseRedirect from django.shortcuts import render, resolve_url from django.core.exceptions import ObjectDoesNotExist -from django.utils.http import is_safe_url +from django.utils.http import url_has_allowed_host_and_scheme import django_comments @@ -28,7 +28,7 @@ def next_redirect(request, fallback, **get_kwargs): Returns an ``HttpResponseRedirect``. """ next = request.POST.get('next') - if not is_safe_url(url=next, allowed_hosts={request.get_host()}): + if not url_has_allowed_host_and_scheme(url=next, allowed_hosts={request.get_host()}): next = resolve_url(fallback) if get_kwargs: |