1
0

Allow requests that never expire

This commit is contained in:
ThomasV
2019-12-10 14:45:29 +01:00
parent daef1a8359
commit f08796fe68
3 changed files with 8 additions and 8 deletions

View File

@@ -104,6 +104,7 @@ pr_tooltips = {
}
pr_expiration_values = {
0: _('Never'),
10*60: _('10 minutes'),
60*60: _('1 hour'),
24*60*60: _('1 day'),
@@ -112,12 +113,13 @@ pr_expiration_values = {
def get_request_status(req):
status = req['status']
if req['status'] == PR_UNPAID and 'exp' in req and req['time'] + req['exp'] < time.time():
exp = req.get('exp', 0)
if req['status'] == PR_UNPAID and exp > 0 and req['time'] + req['exp'] < time.time():
status = PR_EXPIRED
status_str = pr_tooltips[status]
if status == PR_UNPAID:
if req.get('exp'):
expiration = req['exp'] + req['time']
if exp > 0:
expiration = exp + req['time']
status_str = _('Expires') + ' ' + age(expiration, include_seconds=True)
else:
status_str = _('Pending')