diff --git a/static/style.css b/static/style.css
index f745d12..f1a307b 100644
--- a/static/style.css
+++ b/static/style.css
@@ -8,6 +8,12 @@ footer {}
#result {}
-#result-page {}
-
#result-cache {}
+
+.result-page {}
+
+.prot-level {}
+
+.prot-expiry {}
+
+.prot-none {}
diff --git a/templates/index.mako b/templates/index.mako
index 625e9ee..342417b 100644
--- a/templates/index.mako
+++ b/templates/index.mako
@@ -20,7 +20,7 @@
% if "tif" in result:
-
+
TIF |
@@ -32,10 +32,14 @@
Protection |
- ${result["protection"]} |
+ % if result["protection"]:
+ ${result["protection"]["level"]} until ${result["protection"]["expiry"]} |
+ % else:
+ None |
+ % endif
- % if "cache" in result and result["cache"]:
+ % if "cache_time" in result:
Pageview data is cached from up to
${result["cache_age"]} ago.
% endif
diff --git a/tif/calc.py b/tif/calc.py
index a0bf058..3e5e4aa 100644
--- a/tif/calc.py
+++ b/tif/calc.py
@@ -109,6 +109,10 @@ def _format_time(cache_time):
return formatter(diff.seconds / 60, "minute")
return formatter(diff.seconds, "second")
+def _get_protection(page):
+ edit = [prot for prot in page.protection if prot["type"] == "edit"]
+ return edit or None
+
def calculate_tif(title):
bot = Bot(".earwigbot")
db = _get_db(bot)
@@ -124,7 +128,7 @@ def calculate_tif(title):
result["tif"] = tif
result["transclusions"] = transclusions
- result["protection"] = page.protection
+ result["protection"] = _get_protection(page)
if cache_time:
result["cache_time"] = cache_time.strftime("%b %d, %Y %H:%M:%S UTC")
result["cache_ago"] = _format_time(cache_time)