mirror of
https://github.com/lalanza808/monero.fail.git
synced 2025-08-20 21:28:11 -04:00
split resources out
This commit is contained in:
parent
726d2766e8
commit
2fb28e90fb
16 changed files with 532 additions and 481 deletions
27
xmrnodes/filters.py
Normal file
27
xmrnodes/filters.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from datetime import datetime
|
||||
|
||||
import arrow
|
||||
from flask import Blueprint
|
||||
from urllib.parse import urlencode
|
||||
|
||||
bp = Blueprint("filters", "filters")
|
||||
|
||||
|
||||
@bp.app_template_filter("humanize")
|
||||
def humanize(d):
|
||||
t = arrow.get(d, "UTC")
|
||||
return t.humanize()
|
||||
|
||||
|
||||
@bp.app_template_filter("hours_elapsed")
|
||||
def hours_elapsed(d):
|
||||
now = datetime.utcnow()
|
||||
diff = now - d
|
||||
return diff.total_seconds() / 60 / 60
|
||||
|
||||
|
||||
@bp.app_template_filter("pop_arg")
|
||||
def trim_arg(all_args, arg_to_trim):
|
||||
d = all_args.to_dict()
|
||||
d.pop(arg_to_trim)
|
||||
return urlencode(d)
|
Loading…
Add table
Add a link
Reference in a new issue