summaryrefslogtreecommitdiff
path: root/src/jwebmail/view.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jwebmail/view.py')
-rw-r--r--src/jwebmail/view.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/jwebmail/view.py b/src/jwebmail/view.py
deleted file mode 100644
index d435686..0000000
--- a/src/jwebmail/view.py
+++ /dev/null
@@ -1,46 +0,0 @@
-from datetime import datetime
-from math import floor, log2, log10
-
-from markupsafe import Markup
-
-
-def print_sizes10(var):
- i = floor(log10(var) / 3)
- expo = i * 3
-
- PREFIX = [
- "Byte",
- "kByte",
- "MByte",
- "GByte",
- "TByte",
- "PByte",
- ]
-
- return Markup(f"{round(var / (10**expo))} {PREFIX[i]}")
-
-
-def print_sizes2(var):
- i = floor(log2(var) / 10)
- expo = i * 10
-
- PREFIX = [
- "Byte",
- "KiByte",
- "MiByte",
- "GiByte",
- "TiByte",
- "PiByte",
- ]
-
- return Markup(f"{round(var / (2**expo))} {PREFIX[i]}")
-
-
-def parse_iso_date(inp):
- return datetime.fromisoformat(inp)
-
-
-def add_view_funcs(app):
- app.jinja_env.filters["byte_size2"] = print_sizes2
- app.jinja_env.filters["byte_size10"] = print_sizes10
- app.context_processor(lambda: dict(parse_iso_date=parse_iso_date))