From ac68f74c69dfbe6f1319a33fefc6baa1e4f0299d Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 5 Feb 2022 01:34:30 -0800 Subject: [PATCH] fix: Hide Email Address checkbox markup also: - support empty strings in util.strtobool Signed-off-by: Kevin Morris --- aurweb/util.py | 6 +++--- templates/partials/account_form.html | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aurweb/util.py b/aurweb/util.py index 1f75ac22..cb8e4b5b 100644 --- a/aurweb/util.py +++ b/aurweb/util.py @@ -7,7 +7,7 @@ import string from datetime import datetime from distutils.util import strtobool as _strtobool from http import HTTPStatus -from typing import Callable, Iterable, Tuple +from typing import Callable, Iterable, Tuple, Union from urllib.parse import urlparse import fastapi @@ -133,9 +133,9 @@ def sanitize_params(offset: str, per_page: str) -> Tuple[int, int]: return (offset, per_page) -def strtobool(value: str) -> bool: +def strtobool(value: Union[str, bool]) -> bool: if isinstance(value, str): - return _strtobool(value) + return _strtobool(value or "False") return value diff --git a/templates/partials/account_form.html b/templates/partials/account_form.html index f6a24c66..9136ee7a 100644 --- a/templates/partials/account_form.html +++ b/templates/partials/account_form.html @@ -105,7 +105,11 @@ {% trans %}Hide Email Address{% endtrans %}: - +

{{ "If you do not hide your email address, it is "