Archived
Prepare KarlDNS production deployment
This commit is contained in:
1 parent
5a90bd9d87
commit
ce5b4e0ff2
101 files changed
+3364
-2018
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import html
|
||||
|
||||
|
||||
class SafeHtml(str):
|
||||
"""HTML fragment that was built by trusted server-side template helpers."""
|
||||
|
||||
|
||||
def escape(value: object) -> str:
|
||||
return html.escape(str(value), quote=True)
|
||||
|
||||
|
||||
def attr(value: object) -> str:
|
||||
return escape(value)
|
||||
|
||||
|
||||
def trusted(fragment: str) -> SafeHtml:
|
||||
return SafeHtml(fragment)
|
||||
|
||||
|
||||
def join_html(fragments: list[str]) -> SafeHtml:
|
||||
return SafeHtml("".join(fragments))
|
||||
Reference in new issue
Block a user