Skip to content
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
9 changes: 6 additions & 3 deletions openedx/core/djangoapps/user_api/accounts/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
from django.dispatch import Signal

# Signal to retire a user from LMS-initiated mailings (course mailings, etc)
USER_RETIRE_MAILINGS = Signal(providing_args=["user"])
# providing_args=["user"]
USER_RETIRE_MAILINGS = Signal()

# Signal to retire LMS critical information
USER_RETIRE_LMS_CRITICAL = Signal(providing_args=["user"])
# providing_args=["user"]
USER_RETIRE_LMS_CRITICAL = Signal()

# Signal to retire LMS misc information
USER_RETIRE_LMS_MISC = Signal(providing_args=["user"])
# providing_args=["user"]
USER_RETIRE_LMS_MISC = Signal()
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_api/accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH
from completion.models import BlockCompletion
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from social_django.models import UserSocialAuth

from common.djangoapps.student.models import AccountRecovery, Registration, get_retired_email_by_email
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_api/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.db import models, transaction
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from edx_ace import ace
from edx_ace.recipient import Recipient
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils.html import format_html
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from openedx.core.djangoapps.user_api.accounts.forms import RetirementQueueDeletionForm

Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/user_api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django import forms
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.functional import Promise

LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -357,7 +357,7 @@ def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ
Forces evaluation of ugettext_lazy promises.
"""
if isinstance(obj, Promise):
return force_text(obj)
return force_str(obj)
super().default(obj)


Expand Down
10 changes: 5 additions & 5 deletions openedx/core/djangoapps/user_api/preferences/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_noop
from django.utils.translation import gettext as _
from django.utils.translation import gettext_noop
from django_countries import countries
from pytz import common_timezones, common_timezones_set, country_timezones

Expand Down Expand Up @@ -399,7 +399,7 @@ def validate_user_preference_serializer(serializer, preference_key, preference_v
PreferenceValidationError: the supplied key and/or value for a user preference are invalid.
"""
if preference_value is None or str(preference_value).strip() == '':
format_string = ugettext_noop("Preference '{preference_key}' cannot be set to an empty value.")
format_string = gettext_noop("Preference '{preference_key}' cannot be set to an empty value.")
raise PreferenceValidationError({
preference_key: {
"developer_message": format_string.format(preference_key=preference_key),
Expand Down Expand Up @@ -430,8 +430,8 @@ def validate_user_preference_serializer(serializer, preference_key, preference_v
}
})
if preference_key == "time_zone" and preference_value not in common_timezones_set:
developer_message = ugettext_noop("Value '{preference_value}' not valid for preference '{preference_key}': Not in timezone set.") # pylint: disable=line-too-long
user_message = ugettext_noop("Value '{preference_value}' is not a valid time zone selection.")
developer_message = gettext_noop("Value '{preference_value}' not valid for preference '{preference_key}': Not in timezone set.") # pylint: disable=line-too-long
user_message = gettext_noop("Value '{preference_value}' is not a valid time zone selection.")
raise PreferenceValidationError({
preference_key: {
"developer_message": developer_message.format(
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_api/preferences/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


from django.db import transaction
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from rest_framework import permissions, status
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/user_authn/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

log = logging.getLogger(__name__)


CREATE_LOGON_COOKIE = Signal(providing_args=['user', 'response'])
# providing_args=['user', 'response']
CREATE_LOGON_COOKIE = Signal()


JWT_COOKIE_NAMES = (
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/auto_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.shortcuts import redirect
from django.template.context_processors import csrf
from django.urls import NoReverseMatch, reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from opaque_keys.edx.locator import CourseLocator

from lms.djangoapps.verify_student.models import ManualVerification
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views.decorators.csrf import csrf_exempt, csrf_protect, ensure_csrf_cookie
from django.views.decorators.debug import sensitive_post_parameters
from django.views.decorators.http import require_http_methods
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/login_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_http_methods
from ratelimit.decorators import ratelimit
Expand Down
6 changes: 3 additions & 3 deletions openedx/core/djangoapps/user_authn/views/password_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.encoding import force_bytes, force_text
from django.utils.encoding import force_bytes, force_str
from django.utils.http import base36_to_int, int_to_base36, urlsafe_base64_encode
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
from django.views.decorators.http import require_POST
from edx_ace import ace
Expand Down Expand Up @@ -338,7 +338,7 @@ def _uidb36_to_uidb64(uidb36):
Returns: base64-encoded user ID. Otherwise returns a dummy, invalid ID
"""
try:
uidb64 = force_text(urlsafe_base64_encode(force_bytes(base36_to_int(uidb36))))
uidb64 = force_str(urlsafe_base64_encode(force_bytes(base36_to_int(uidb36))))
except ValueError:
uidb64 = '1' # dummy invalid ID (incorrect padding for base64)
return uidb64
Expand Down
5 changes: 3 additions & 2 deletions openedx/core/djangoapps/user_authn/views/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import get_language
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
from django.views.decorators.debug import sensitive_post_parameters
from edx_django_utils.monitoring import set_custom_attribute
Expand Down Expand Up @@ -101,7 +101,8 @@
REGISTRATION_UTM_CREATED_AT = 'registration_utm_created_at'
MARKETING_EMAILS_OPT_IN = 'marketing_emails_opt_in'
# used to announce a registration
REGISTER_USER = Signal(providing_args=["user", "registration"])
# providing_args=["user", "registration"]
REGISTER_USER = Signal()


# .. toggle_name: registration.enable_failure_logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.core.validators import RegexValidator, ValidationError, slug_re
from django.forms import widgets
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django_countries import countries

from common.djangoapps import third_party_auth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from edx_toggles.toggles.testutils import override_waffle_flag
from freezegun import freeze_time
from pytz import UTC
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from django.conf import settings
from django.contrib import messages
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from ipware.ip import get_client_ip

from common.djangoapps import third_party_auth
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/util/user_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from django.conf import settings
from django.contrib import messages
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from edx_toggles.toggles import SettingToggle

from openedx.core.djangolib.markup import HTML, Text
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/verified_track_content/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


from django import forms
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey

Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/verified_track_content/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver

from django.utils.translation import ugettext_lazy
from django.utils.translation import gettext_lazy
from edx_django_utils.cache import RequestCache
from opaque_keys.edx.django.models import CourseKeyField

Expand Down Expand Up @@ -100,7 +100,7 @@ class VerifiedTrackCohortedCourse(models.Model):
"""
course_key = CourseKeyField(
max_length=255, db_index=True, unique=True,
help_text=ugettext_lazy("The course key for the course we would like to be auto-cohorted.")
help_text=gettext_lazy("The course key for the course we would like to be auto-cohorted.")
)

verified_cohort_name = models.CharField(max_length=100, default=DEFAULT_VERIFIED_COHORT_NAME)
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/video_pipeline/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib.auth import get_user_model
from django.db import models

from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from opaque_keys.edx.django.models import CourseKeyField


Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/waffle_utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from django.db.models import CharField, TextField
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from model_utils import Choices
from opaque_keys.edx.django.models import CourseKeyField

Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/xblock/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import threading

from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from opaque_keys.edx.keys import UsageKeyV2
from opaque_keys.edx.locator import BundleDefinitionLocator
from rest_framework.exceptions import NotFound
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/xblock/runtime/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""


from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from xblock.core import XBlock, XBlockMixin
from xblock.exceptions import JsonHandlerError
from web_fragments.fragment import Fragment
Expand Down
6 changes: 3 additions & 3 deletions openedx/core/djangolib/tests/test_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import ddt
from bs4 import BeautifulSoup
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from django.utils.translation import gettext as _
from django.utils.translation import ngettext
from mako.template import Template

from openedx.core.djangolib.markup import HTML, Text, strip_all_tags_but_br
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_mako(self):

def test_ungettext(self):
for i in [1, 2]:
out = Text(ungettext("1 & {}", "2 & {}", i)).format(HTML("<>"))
out = Text(ngettext("1 & {}", "2 & {}", i)).format(HTML("<>"))
assert out == f'{i} &amp; <>'

def test_strip_all_tags_but_br_filter(self):
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/lib/api/view_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from django.core.exceptions import NON_FIELD_ERRORS, ObjectDoesNotExist, ValidationError
from django.http import Http404, HttpResponseBadRequest
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from opaque_keys import InvalidKeyError
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/lib/cache_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import wrapt
from django.db.models.signals import post_save, post_delete
from django.utils.encoding import force_text
from django.utils.encoding import force_str

from edx_django_utils.cache import RequestCache, TieredCache

Expand Down Expand Up @@ -87,7 +87,7 @@ def _func_call_cache_key(func, arg_map_function, *args, **kwargs):
the function's name, a stringified list of arguments
and a stringified list of keyword arguments.
"""
arg_map_function = arg_map_function or force_text
arg_map_function = arg_map_function or force_str

converted_args = list(map(arg_map_function, args))
converted_kwargs = list(map(arg_map_function, _sorted_kwargs_list(kwargs)))
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/lib/gating/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from completion.models import BlockCompletion
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from milestones import api as milestones_api
from opaque_keys.edx.keys import UsageKey
from xblock.completable import XBlockCompletionMode as CompletionMode
Expand Down