Add a redirect for the letter specification

This way we have a URL we can give people that always points to the
latest version of the spec.

And it makes our code more Flask-idiomatic to be using `url_for` to be
generating a URL, rather than passing around a constant.
This commit is contained in:
Chris Hill-Scott
2020-01-15 10:56:14 +00:00
parent b57e4a0d0d
commit 3762daad84
8 changed files with 45 additions and 28 deletions

View File

@@ -17,11 +17,7 @@ from app.main import main
from app.main.forms import FieldWithNoneOption, SearchByNameForm
from app.main.views.feedback import QUESTION_TICKET_TYPE
from app.main.views.sub_navigation_dictionaries import features_nav, pricing_nav
from app.utils import (
LETTER_SPECIFICATION_URL,
get_logo_cdn_domain,
user_is_logged_in,
)
from app.utils import get_logo_cdn_domain, user_is_logged_in
@main.route('/')
@@ -273,7 +269,6 @@ def features_sms():
def features_letters():
return render_template(
'views/features/letters.html',
letter_specification_url=LETTER_SPECIFICATION_URL,
navigation_links=features_nav()
)
@@ -348,3 +343,11 @@ def old_page_redirects():
'main.old_integration_testing': 'main.integration_testing',
}
return redirect(url_for(redirects[request.endpoint]), code=301)
@main.route('/docs/notify-pdf-letter-spec-latest.pdf')
def letter_spec():
return redirect(
'https://docs.notifications.service.gov.uk'
'/documentation/images/notify-pdf-letter-spec-v2.4.pdf'
)

View File

@@ -33,7 +33,6 @@ from app.s3_client.s3_letter_upload_client import (
)
from app.template_previews import TemplatePreview, sanitise_letter
from app.utils import (
LETTER_SPECIFICATION_URL,
generate_next_dict,
generate_previous_dict,
get_letter_validation_error,
@@ -66,7 +65,6 @@ def uploads(service_id):
prev_page=prev_page,
next_page=next_page,
scheduled_jobs='',
letter_specification_url=LETTER_SPECIFICATION_URL,
)