diff --git a/aurweb/auth.py b/aurweb/auth.py
index 6544dce2..5e45ee83 100644
--- a/aurweb/auth.py
+++ b/aurweb/auth.py
@@ -99,7 +99,7 @@ class BasicAuthBackend(AuthenticationBackend):
sid = conn.cookies.get("AURSID")
if not sid:
- return None, AnonymousUser()
+ return (None, AnonymousUser())
now_ts = datetime.utcnow().timestamp()
record = session.query(Session).filter(
@@ -108,7 +108,7 @@ class BasicAuthBackend(AuthenticationBackend):
# If no session with sid and a LastUpdateTS now or later exists.
if not record:
- return None, AnonymousUser()
+ return (None, AnonymousUser())
# At this point, we cannot have an invalid user if the record
# exists, due to ForeignKey constraints in the schema upheld
@@ -117,7 +117,7 @@ class BasicAuthBackend(AuthenticationBackend):
user.nonce = util.make_nonce()
user.authenticated = True
- return AuthCredentials(["authenticated"]), user
+ return (AuthCredentials(["authenticated"]), user)
def auth_required(is_required: bool = True,
diff --git a/aurweb/routers/accounts.py b/aurweb/routers/accounts.py
index 4c4ce849..3e134e7a 100644
--- a/aurweb/routers/accounts.py
+++ b/aurweb/routers/accounts.py
@@ -126,26 +126,26 @@ def process_account_form(request: Request, user: models.User, args: dict):
host = request.client.host
ban = db.query(models.Ban, models.Ban.IPAddress == host).first()
if ban:
- return False, [
+ return (False, [
"Account registration has been disabled for your "
"IP address, probably due to sustained spam attacks. "
"Sorry for the inconvenience."
- ]
+ ])
if request.user.is_authenticated():
if not request.user.valid_password(args.get("passwd", None)):
- return False, ["Invalid password."]
+ return (False, ["Invalid password."])
email = args.get("E", None)
username = args.get("U", None)
if not email or not username:
- return False, ["Missing a required field."]
+ return (False, ["Missing a required field."])
username_min_len = aurweb.config.getint("options", "username_min_len")
username_max_len = aurweb.config.getint("options", "username_max_len")
if not util.valid_username(args.get("U")):
- return False, [
+ return (False, [
"The username is invalid.",
[
_("It must be between %s and %s characters long") % (
@@ -153,20 +153,20 @@ def process_account_form(request: Request, user: models.User, args: dict):
"Start and end with a letter or number",
"Can contain only one period, underscore or hyphen.",
]
- ]
+ ])
password = args.get("P", None)
if password:
confirmation = args.get("C", None)
if not util.valid_password(password):
- return False, [
+ return (False, [
_("Your password must be at least %s characters.") % (
username_min_len)
- ]
+ ])
elif not confirmation:
- return False, ["Please confirm your new password."]
+ return (False, ["Please confirm your new password."])
elif password != confirmation:
- return False, ["Password fields do not match."]
+ return (False, ["Password fields do not match."])
backup_email = args.get("BE", None)
homepage = args.get("HP", None)
@@ -184,32 +184,32 @@ def process_account_form(request: Request, user: models.User, args: dict):
func.lower(models.User.Email) == email.lower())
if not util.valid_email(email):
- return False, ["The email address is invalid."]
+ return (False, ["The email address is invalid."])
elif backup_email and not util.valid_email(backup_email):
- return False, ["The backup email address is invalid."]
+ return (False, ["The backup email address is invalid."])
elif homepage and not util.valid_homepage(homepage):
- return False, [
- "The home page is invalid, please specify the full HTTP(s) URL."]
+ return (False, [
+ "The home page is invalid, please specify the full HTTP(s) URL."])
elif pgp_key and not util.valid_pgp_fingerprint(pgp_key):
- return False, ["The PGP key fingerprint is invalid."]
+ return (False, ["The PGP key fingerprint is invalid."])
elif ssh_pubkey and not util.valid_ssh_pubkey(ssh_pubkey):
- return False, ["The SSH public key is invalid."]
+ return (False, ["The SSH public key is invalid."])
elif language and language not in l10n.SUPPORTED_LANGUAGES:
- return False, ["Language is not currently supported."]
+ return (False, ["Language is not currently supported."])
elif timezone and timezone not in time.SUPPORTED_TIMEZONES:
- return False, ["Timezone is not currently supported."]
+ return (False, ["Timezone is not currently supported."])
elif db.query(models.User, username_exists(username)).first():
# If the username already exists...
- return False, [
+ return (False, [
_("The username, %s%s%s, is already in use.") % (
"", username, "")
- ]
+ ])
elif db.query(models.User, email_exists(email)).first():
# If the email already exists...
- return False, [
+ return (False, [
_("The address, %s%s%s, is already in use.") % (
"", email, "")
- ]
+ ])
def ssh_fingerprint_exists(fingerprint):
return and_(models.SSHPubKey.UserID != user.ID,
@@ -218,26 +218,26 @@ def process_account_form(request: Request, user: models.User, args: dict):
if ssh_pubkey:
fingerprint = get_fingerprint(ssh_pubkey.strip().rstrip())
if fingerprint is None:
- return False, ["The SSH public key is invalid."]
+ return (False, ["The SSH public key is invalid."])
if db.query(models.SSHPubKey,
ssh_fingerprint_exists(fingerprint)).first():
- return False, [
+ return (False, [
_("The SSH public key, %s%s%s, is already in use.") % (
"", fingerprint, "")
- ]
+ ])
captcha_salt = args.get("captcha_salt", None)
if captcha_salt and captcha_salt not in get_captcha_salts():
- return False, ["This CAPTCHA has expired. Please try again."]
+ return (False, ["This CAPTCHA has expired. Please try again."])
captcha = args.get("captcha", None)
if captcha:
answer = get_captcha_answer(get_captcha_token(captcha_salt))
if captcha != answer:
- return False, ["The entered CAPTCHA answer is invalid."]
+ return (False, ["The entered CAPTCHA answer is invalid."])
- return True, []
+ return (True, [])
def make_account_form_context(context: dict,
diff --git a/aurweb/scripts/rendercomment.py b/aurweb/scripts/rendercomment.py
index dd5da4f9..355ca050 100755
--- a/aurweb/scripts/rendercomment.py
+++ b/aurweb/scripts/rendercomment.py
@@ -44,7 +44,7 @@ class FlysprayLinksInlineProcessor(markdown.inlinepatterns.InlineProcessor):
el = markdown.util.etree.Element('a')
el.set('href', f'https://bugs.archlinux.org/task/{m.group(1)}')
el.text = markdown.util.AtomicString(m.group(0))
- return el, m.start(0), m.end(0)
+ return (el, m.start(0), m.end(0))
class FlysprayLinksExtension(markdown.extensions.Extension):
@@ -71,7 +71,7 @@ class GitCommitsInlineProcessor(markdown.inlinepatterns.InlineProcessor):
oid = m.group(1)
if oid not in self._repo:
# Unkwown OID; preserve the orginal text.
- return None, None, None
+ return (None, None, None)
prefixlen = 12
while prefixlen < 40:
@@ -82,7 +82,7 @@ class GitCommitsInlineProcessor(markdown.inlinepatterns.InlineProcessor):
el = markdown.util.etree.Element('a')
el.set('href', commit_uri % (self._head, oid[:prefixlen]))
el.text = markdown.util.AtomicString(oid[:prefixlen])
- return el, m.start(0), m.end(0)
+ return (el, m.start(0), m.end(0))
class GitCommitsExtension(markdown.extensions.Extension):