diff options
author | Ben Sturmfels <ben@sturm.com.au> | 2021-03-05 23:12:19 +1100 |
---|---|---|
committer | Ben Sturmfels <ben@sturm.com.au> | 2021-03-05 23:12:19 +1100 |
commit | dec47c7102cf0aa3a4debf002928db8e460c0d71 (patch) | |
tree | 47631fc15c7af172aa699506adf3d76d3a71976c /mediagoblin/auth/tools.py | |
parent | 5f3a782fef4855e10b7259624a14d8afb0f7be93 (diff) | |
download | mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.tar.lz mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.tar.xz mediagoblin-dec47c7102cf0aa3a4debf002928db8e460c0d71.zip |
Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.
Diffstat (limited to 'mediagoblin/auth/tools.py')
-rw-r--r-- | mediagoblin/auth/tools.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mediagoblin/auth/tools.py b/mediagoblin/auth/tools.py index ae6fadf6..0312cc8f 100644 --- a/mediagoblin/auth/tools.py +++ b/mediagoblin/auth/tools.py @@ -47,12 +47,12 @@ def normalize_user_or_email_field(allow_email=True, allow_user=True, If is_login is True, does not check the length of username. """ - message = _(u'Invalid User name or email address.') - nomail_msg = _(u"This field does not take email addresses.") - nouser_msg = _(u"This field requires an email address.") + message = _('Invalid User name or email address.') + nomail_msg = _("This field does not take email addresses.") + nouser_msg = _("This field requires an email address.") def _normalize_field(form, field): - email = u'@' in field.data + email = '@' in field.data if email: # normalize email address casing if not allow_email: raise wtforms.ValidationError(nomail_msg) @@ -71,8 +71,8 @@ def normalize_user_or_email_field(allow_email=True, allow_user=True, EMAIL_VERIFICATION_TEMPLATE = ( - u"{uri}?" - u"token={verification_key}") + "{uri}?" + "token={verification_key}") def send_verification_email(user, request, email=None, @@ -121,11 +121,11 @@ def basic_extra_validation(register_form, *args): if users_with_username: register_form.username.errors.append( - _(u'Sorry, a user with that name already exists.')) + _('Sorry, a user with that name already exists.')) extra_validation_passes = False if users_with_email: register_form.email.errors.append( - _(u'Sorry, a user with that email address already exists.')) + _('Sorry, a user with that email address already exists.')) extra_validation_passes = False return extra_validation_passes @@ -144,7 +144,7 @@ def register_user(request, register_form): user.save() # log the user in - request.session['user_id'] = six.text_type(user.id) + request.session['user_id'] = str(user.id) request.session.save() # send verification email |