fix: Hide Email Address checkbox markup

also:
- support empty strings in util.strtobool

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-02-05 01:34:30 -08:00
parent 6986d1bb1e
commit ac68f74c69
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
2 changed files with 8 additions and 4 deletions

View file

@ -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

View file

@ -105,7 +105,11 @@
{% trans %}Hide Email Address{% endtrans %}:
</label>
<input id="id_hide" type="checkbox" name="H" value="{{ H }}">
<input id="id_hide" type="checkbox" name="H"
{% if hide_email %}
checked="checked"
{% endif %}
>
</p>
<p>
<em>{{ "If you do not hide your email address, it is "