Use named arguments for clearer string formatting

Helps when the string is long.

Also helps disambiguate between the CDN domain used for the logos and
those for CSS/JS.
This commit is contained in:
Chris Hill-Scott
2018-11-29 11:41:13 +00:00
parent fe6610c221
commit bc6b9c7af7
7 changed files with 20 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ from app.main.s3_client import (
persist_logo,
upload_logo,
)
from app.utils import AgreementInfo, get_cdn_domain, user_is_platform_admin
from app.utils import AgreementInfo, get_logo_cdn_domain, user_is_platform_admin
@main.route("/email-branding", methods=['GET', 'POST'])
@@ -81,7 +81,7 @@ def update_email_branding(branding_id, logo=None):
'views/email-branding/manage-branding.html',
form=form,
email_branding=email_branding,
cdn_url=get_cdn_domain(),
cdn_url=get_logo_cdn_domain(),
logo=logo
)
@@ -126,7 +126,7 @@ def create_email_branding(logo=None):
return render_template(
'views/email-branding/manage-branding.html',
form=form,
cdn_url=get_cdn_domain(),
cdn_url=get_logo_cdn_domain(),
logo=logo
)

View File

@@ -16,7 +16,7 @@ from app import email_branding_client
from app.main import main
from app.main.forms import SearchTemplatesForm
from app.main.views.sub_navigation_dictionaries import features_nav
from app.utils import AgreementInfo, get_cdn_domain
from app.utils import AgreementInfo, get_logo_cdn_domain
@main.route('/')
@@ -108,7 +108,7 @@ def email_template():
colour = email_branding['colour']
brand_name = email_branding['text']
brand_colour = colour
brand_logo = ('https://{}/{}'.format(get_cdn_domain(), email_branding['logo'])
brand_logo = ('https://{}/{}'.format(get_logo_cdn_domain(), email_branding['logo'])
if email_branding['logo'] else None)
govuk_banner = branding_type in ['govuk', 'both']
brand_banner = branding_type == 'org_banner'

View File

@@ -54,7 +54,7 @@ from app.main.forms import (
from app.utils import (
AgreementInfo,
email_safe,
get_cdn_domain,
get_logo_cdn_domain,
user_has_permissions,
user_is_platform_admin,
)
@@ -991,7 +991,7 @@ def get_branding_as_value_and_label(email_branding):
def get_branding_as_dict(email_branding):
return {
branding['id']: {
'logo': 'https://{}/{}'.format(get_cdn_domain(), branding['logo']),
'logo': 'https://{}/{}'.format(get_logo_cdn_domain(), branding['logo']),
'colour': branding['colour']
} for branding in email_branding
}