From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 26 Jan 2025 10:20:12 +0000 (+0100)
Subject: Enable autoescape for web server's Jinja environment.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D/all?a=commitdiff_plain;p=plomlib

Enable autoescape for web server's Jinja environment.
---

diff --git a/web.py b/web.py
index 629e63b..813d0fc 100644
--- a/web.py
+++ b/web.py
@@ -20,7 +20,8 @@ class PlomHttpServer(HTTPServer):
 
     def __init__(self, templates_dir: Path, *args, **kwargs) -> None:
         super().__init__(*args, **kwargs)
-        self.jinja = JinjaEnv(loader=JinjaFSLoader(templates_dir))
+        self.jinja = JinjaEnv(loader=JinjaFSLoader(templates_dir),
+                              autoescape=True)
 
     def serve(self) -> None:
         """Do .serve_forever on .server_port/.server_address until ^C."""