diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 59f4d55..64d10a1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,14 +11,9 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ['3.11', '3.12']
+ python-version: ['3.12']
django-version: ['4.2', '5.0', 'dev']
- exclude:
- - python-version: '3.12'
- django-version: '4.2'
- - python-version: '3.11'
- django-version: 'dev'
services:
mysql:
image: mysql:latest
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a32918b..c3fd69a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,20 +3,20 @@ exclude: tests/etc/user-*
repos:
- repo: https://github.com/PyCQA/bandit
- rev: 1.7.7
+ rev: 1.7.9
hooks:
- id: bandit
args:
- "-x *test*.py"
- repo: https://github.com/psf/black
- rev: 24.2.0
+ rev: 24.8.0
hooks:
- id: black
- language_version: python3.11
+ language_version: python3.12
- repo: https://github.com/pycqa/flake8
- rev: 7.0.0
+ rev: 7.1.1
hooks:
- id: flake8
args:
@@ -28,7 +28,7 @@ repos:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.5.0
+ rev: v4.6.0
hooks:
- id: requirements-txt-fixer
files: requirements/.*\.txt$
@@ -42,7 +42,7 @@ repos:
- id: detect-private-key
- repo: https://github.com/adrienverge/yamllint
- rev: v1.34.0
+ rev: v1.35.1
hooks:
- id: yamllint
args:
diff --git a/edc_adverse_event/templatetags/edc_adverse_event_extras.py b/edc_adverse_event/templatetags/edc_adverse_event_extras.py
index e8b66cf..5c212fe 100644
--- a/edc_adverse_event/templatetags/edc_adverse_event_extras.py
+++ b/edc_adverse_event/templatetags/edc_adverse_event_extras.py
@@ -47,12 +47,16 @@ class DeathReportModel(DeathReportModelMixin, BaseUuidModel): ...
register = template.Library()
-def wrapx(text, length):
+def wrapx(text: str, length: int) -> str:
if length:
return "
".join(wrap(text, length))
return text
+def escape_braces(text: str) -> str:
+ return text.replace("{", "{{").replace("}", "}}")
+
+
def select_ae_template(relative_path):
"""Returns a template object."""
local_path = f"{get_adverse_event_app_label()}/bootstrap{get_bootstrap_version()}/"
@@ -78,10 +82,14 @@ def format_ae_description(context, ae_initial, wrap_length):
context["YES"] = YES
context["ae_initial"] = ae_initial
try:
- context["sae_reason"] = format_html(wrapx(ae_initial.sae_reason.name, wrap_length))
+ context["sae_reason"] = format_html(
+ wrapx(escape_braces(ae_initial.sae_reason.name), wrap_length)
+ )
except AttributeError:
context["sae_reason"] = ""
- context["ae_description"] = format_html(wrapx(ae_initial.ae_description, wrap_length))
+ context["ae_description"] = format_html(
+ wrapx(escape_braces(ae_initial.ae_description), wrap_length)
+ )
return context
@@ -96,13 +104,15 @@ def format_ae_followup_description(context, ae_followup, wrap_length):
context["ae_initial"] = ae_followup.ae_initial
try:
context["sae_reason"] = format_html(
- wrapx(ae_followup.ae_initial.sae_reason.name, wrap_length)
+ wrapx(escape_braces(ae_followup.ae_initial.sae_reason.name), wrap_length)
)
except AttributeError:
context["sae_reason"] = ""
- context["relevant_history"] = format_html(wrapx(ae_followup.relevant_history, wrap_length))
+ context["relevant_history"] = format_html(
+ wrapx(escape_braces(ae_followup.relevant_history), wrap_length)
+ )
context["ae_description"] = format_html(
- wrapx(ae_followup.ae_initial.ae_description, wrap_length)
+ wrapx(escape_braces(ae_followup.ae_initial.ae_description), wrap_length)
)
return context
@@ -116,10 +126,12 @@ def format_ae_susar_description(context, ae_susar, wrap_length):
context["ae_susar"] = ae_susar
context["ae_initial"] = ae_susar.ae_initial
context["sae_reason"] = format_html(
- "
".join(wrap(ae_susar.ae_initial.sae_reason.name, wrap_length or 35))
+ "
".join(
+ wrap(escape_braces(ae_susar.ae_initial.sae_reason.name), wrap_length or 35)
+ )
)
context["ae_description"] = format_html(
- wrapx(ae_susar.ae_initial.ae_description, wrap_length)
+ wrapx(escape_braces(ae_susar.ae_initial.ae_description), wrap_length)
)
return context
diff --git a/pyproject.toml b/pyproject.toml
index 2b42cad..de1702a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,12 +6,12 @@ version_file="_version.py"
[tool.black]
line-length = 95
-target-version = ["py311"]
+target-version = ["py312"]
extend-exclude = '''^(.*\/)*\b(migrations)\b($|\/.*$)'''
[tool.isort]
profile = "black"
-py_version = "311"
+py_version = "312"
skip = [".tox", ".eggs", "migrations"]
[tool.coverage.run]
@@ -35,15 +35,13 @@ exclude_lines = [
legacy_tox_ini = """
[tox]
envlist =
- py{311}-dj{42,50},
- py{312}-dj{50,dev},
+ py{312}-dj{42,50,dev},
lint
isolated_build = true
[gh-actions]
python =
- 3.11: py311
3.12: py312, lint
[gh-actions:env]
diff --git a/setup.cfg b/setup.cfg
index 7bd1588..3dad30b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,12 +16,12 @@ classifiers=
Intended Audience :: Developers
Intended Audience :: Science/Research
Operating System :: OS Independent
- Programming Language :: Python :: 3.11
+ Programming Language :: Python :: 3.12
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
[options]
-python_requires = >=3.11
+python_requires = >=3.12
zip_safe = False
include_package_data = True
packages = find: