Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Replace ugettext with gettext
Browse files Browse the repository at this point in the history
Fix flake8 warnings
  • Loading branch information
ObserverOfTime committed Dec 28, 2020
1 parent f5df9fa commit 4cd8ee5
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019-2020, MangAdventure
Copyright (c) 2019-2021, MangAdventure
Copyright (c) 2013-2019, Django Software Foundation and individual contributors

All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Django Commentary
:alt: PyPI

.. image:: https://img.shields.io/travis/mangadventure/django-commentary?label=Travis&logo=travis
:target: https://travis-ci.org/mangadventure/django-commentary
:target: https://travis-ci.com/mangadventure/django-commentary
:alt: Travis CI

This framework can be used to attach comments to any model, so you can use it
Expand Down
2 changes: 1 addition & 1 deletion commentary/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.urls import reverse
from django.utils.html import strip_tags
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from . import COMMENTS_ALLOW_HTML, get_user_display
from .managers import CommentManager
Expand Down
10 changes: 5 additions & 5 deletions commentary/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 commentary import get_model
from commentary.views.moderation import (
Expand Down Expand Up @@ -38,23 +38,23 @@ def get_actions(self, request):
def flag_comments(self, request, queryset):
self._bulk_flag(
request, queryset, perform_flag,
lambda n: ungettext('flagged', 'flagged', n)
lambda n: ngettext('flagged', 'flagged', n)
)

flag_comments.short_description = _('Flag selected comments')

def approve_comments(self, request, queryset):
self._bulk_flag(
request, queryset, perform_approve,
lambda n: ungettext('approved', 'approved', n)
lambda n: ngettext('approved', 'approved', n)
)

approve_comments.short_description = _('Approve selected comments')

def remove_comments(self, request, queryset):
self._bulk_flag(
request, queryset, perform_delete,
lambda n: ungettext('removed', 'removed', n)
lambda n: ngettext('removed', 'removed', n)
)

remove_comments.short_description = _('Remove selected comments')
Expand All @@ -68,7 +68,7 @@ def _bulk_flag(self, request, queryset, action, done_message):
for comment in queryset:
action(request, comment)
n_comments += 1
msg = ungettext(
msg = ngettext(
'%(count)s comment was successfully %(action)s.',
'%(count)s comments were successfully %(action)s.', n_comments
)
Expand Down
2 changes: 1 addition & 1 deletion commentary/feeds.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.syndication.views import Feed
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from . import get_model

Expand Down
6 changes: 1 addition & 5 deletions commentary/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
from django.forms.utils import ErrorDict
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.encoding import force_text
from django.utils.text import get_text_list
from django.utils.translation import (
pgettext_lazy, ungettext, ugettext, ugettext_lazy as _
)
from django.utils.translation import gettext_lazy as _

from . import COMMENTS_TIMEOUT, COMMENTS_WIDGET, get_model
from .models import Comment


class CommentSecurityForm(forms.Form):
Expand Down
2 changes: 1 addition & 1 deletion commentary/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from . import get_user_display
from .abstracts import CommentAbstractModel
Expand Down
2 changes: 1 addition & 1 deletion commentary/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class EntryModerator(CommentModerator):
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 _

from . import get_model, signals

Expand Down
4 changes: 1 addition & 3 deletions commentary/views/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.messages import error
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.shortcuts import render
from django.template.loader import render_to_string
from django.utils.html import escape
from django.views.decorators.cache import patch_cache_control
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.http import require_POST

from commentary import get_form, get_user_display, signals
from commentary import get_form, signals


class CommentPostBadRequest(http.HttpResponseBadRequest):
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
exclude = docs/*
ignore = E128
max-line-length = 119
ignore = E128,W504
max-line-length = 120

[wheel]
universal = 1
5 changes: 3 additions & 2 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
parent = os.path.dirname(here)
sys.path[0:0] = [here, parent]

from django.conf import settings
from django.conf import settings # noqa
settings.configure(
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3'}},
INSTALLED_APPS=[
Expand Down Expand Up @@ -49,7 +49,7 @@
SITE_ID=1,
)

from django.test.runner import DiscoverRunner
from django.test.runner import DiscoverRunner # noqa


def main(test_labels=None):
Expand All @@ -58,6 +58,7 @@ def main(test_labels=None):
failures = runner.run_tests(test_labels or ['testapp'], interactive=True)
sys.exit(failures)


if __name__ == '__main__':
test_labels = None
if len(sys.argv) > 1:
Expand Down

0 comments on commit 4cd8ee5

Please sign in to comment.