web_framework, tests: Workaround captcha 0.5.6 vs. Django 3.2

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2021-09-17 11:17:30 -07:00 committed by James Valleroy
parent c5c1f5594d
commit 28c1d5eda3
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,12 @@ Django settings for test modules.
import os
# Workaround for django-simple-captcha 0.5.6 not being compatible with
# Django 3.2. 0.5.14 is almost there in Debian. Workaround only until then.
import django.utils.encoding
django.utils.encoding.python_2_unicode_compatible = lambda x: x
TEST_DATA_DIR = os.path.dirname(os.path.abspath(__file__))
AXES_ENABLED = False

View File

@ -22,6 +22,10 @@ logger = logging.getLogger(__name__)
def init(read_only=False):
"""Setup Django configuration in the absence of .settings file"""
# Workaround for django-simple-captcha 0.5.6 not being compatible with
# Django 3.2. 0.5.14 is almost there in Debian. Workaround only until then.
django.utils.encoding.python_2_unicode_compatible = lambda x: x
if cfg.secure_proxy_ssl_header:
settings.SECURE_PROXY_SSL_HEADER = (cfg.secure_proxy_ssl_header,
'https')