Move letter too long banner message over from utils, also refactor

This commit is contained in:
Pea Tyczynska
2019-10-01 17:16:15 +01:00
parent b42c7c4c9f
commit 12ec2870af
14 changed files with 63 additions and 38 deletions

View File

@@ -43,6 +43,8 @@ FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure',
'technical-failure', 'virus-scan-failed', 'validation-failed']
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
LETTER_MAX_PAGES = 10
with open('{}/email_domains.txt'.format(
os.path.dirname(os.path.realpath(__file__))
)) as email_domains:
@@ -543,6 +545,12 @@ def get_letter_printing_statement(status, created_at):
return 'Printed on {} at 5:30pm'.format(printed_date)
def is_letter_too_long(page_count):
if not page_count:
return False
return page_count > LETTER_MAX_PAGES
class PermanentRedirect(RequestRedirect):
"""
In Werkzeug 0.15.0 the status code for RequestRedirect changed from 301 to 308.