Allow requests that never expire
This commit is contained in:
@@ -117,7 +117,7 @@ class RequestList(MyTreeView):
|
||||
continue
|
||||
request_type = req['type']
|
||||
timestamp = req.get('time', 0)
|
||||
expiration = req.get('exp', None)
|
||||
expiration = req.get('exp', 0)
|
||||
amount = req.get('amount')
|
||||
message = req.get('message') or req.get('memo')
|
||||
date = format_time(timestamp)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -1527,12 +1527,10 @@ class Abstract_Wallet(AddressSynchronizer):
|
||||
timestamp = r.get('time', 0)
|
||||
if timestamp and type(timestamp) != int:
|
||||
timestamp = 0
|
||||
expiration = r.get('exp')
|
||||
if expiration and type(expiration) != int:
|
||||
expiration = 0
|
||||
exp = r.get('exp', 0)
|
||||
paid, conf = self.get_payment_status(address, amount)
|
||||
if not paid:
|
||||
if expiration is not None and time.time() > timestamp + expiration:
|
||||
if exp > 0 and time.time() > timestamp + exp:
|
||||
status = PR_EXPIRED
|
||||
else:
|
||||
status = PR_UNPAID
|
||||
|
||||
Reference in New Issue
Block a user