Archived
Build KarlDNS self-hosted DynDNS service
This commit is contained in:
1 parent
45bc38d950
commit
ca92dc211a
65 files changed
+9200
-3570
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