Fix license bug on test environments
This commit is contained in:
parent
583bc8d0c3
commit
7691774426
|
|
@ -367,7 +367,10 @@ class License(models.Model):
|
|||
if not is_aware(expiry_date):
|
||||
expiry_date = make_aware(expiry_date)
|
||||
|
||||
return expiry_date >= now >= expiry_date - timedelta(days=licenses[isbn]['duration'])
|
||||
try:
|
||||
return expiry_date >= now >= expiry_date - timedelta(days=licenses[isbn]['duration'])
|
||||
except KeyError: # this can happen if the platform changed, e.g. during local testing
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return f'License for role: {self.for_role}'
|
||||
|
|
|
|||
Loading…
Reference in New Issue