Formatting changes and typo

This commit is contained in:
sayali 2020-10-09 17:57:35 -07:00
parent 475833e8e1
commit fb4df8865b
2 changed files with 4 additions and 8 deletions

View File

@ -194,7 +194,7 @@ class CertificateEditInputSchema(CertificateSchema):
# Add required role
owner_role = roles_service.get_or_create(
data["owner"],
description="Auto generated role based on owner: {0}".format(data["owner"])
description=f"Auto generated role based on owner: {data['owner']}"
)
# Put role info in correct format using RoleNestedOutputSchema
@ -210,7 +210,7 @@ class CertificateEditInputSchema(CertificateSchema):
def enforce_notifications(self, data):
"""
Add default notification for current owner if none exist.
This ensures that the default notifications are added in the even of owner change.
This ensures that the default notifications are added in the event of owner change.
Old owner notifications are retained unless explicitly removed later in the code path.
:param data:
:return:

View File

@ -258,9 +258,7 @@ def update(cert_id, **kwargs):
def cleanup_owner_roles_notification(owner_name, kwargs):
kwargs["roles"] = [r for r in kwargs["roles"] if r.name != owner_name]
notification_prefix = "DEFAULT_{0}".format(
owner_name.split("@")[0].upper()
)
notification_prefix = f"DEFAULT_{owner_name.split('@')[0].upper()}"
kwargs["notifications"] = [n for n in kwargs["notifications"] if not n.label.startswith(notification_prefix)]
@ -279,9 +277,7 @@ def create_certificate_roles(**kwargs):
# create a role for the owner and assign it
owner_role = role_service.get_or_create(
kwargs["owner"],
description="Auto generated role based on owner: {0}".format(
kwargs["owner"]
)
description=f"Auto generated role based on owner: {kwargs['owner']}"
)
# ensure that the authority's owner is also associated with the certificate