From d2f33d8e854b7fda6bae389d983025e6c8609842 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 20 May 2024 10:09:52 +0200 Subject: Factor download page and file --- src/templates.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/templates.py') diff --git a/src/templates.py b/src/templates.py index 1308fc0..c605e57 100644 --- a/src/templates.py +++ b/src/templates.py @@ -1,4 +1,5 @@ import html +import datetime page: str = ''' @@ -79,13 +80,14 @@ index: str = f''' ''' def download(href: str, filename: str, expires: str) -> str: + expires_in = datetime.datetime.strptime(expires, '%Y-%m-%d %H:%M:%S') - datetime.datetime.now() return f''' {page}
{html.escape(filename)}
- Expires: {html.escape(expires)} + Expires in {expires_in}
''' @@ -93,5 +95,5 @@ def download(href: str, filename: str, expires: str) -> str: not_found: str = f''' {page} - Sorry, the file you are looking for can not be found. It may have already expired. + Oops, not found! ''' -- cgit v1.2.3