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 # Add required role
owner_role = roles_service.get_or_create( owner_role = roles_service.get_or_create(
data["owner"], 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 # Put role info in correct format using RoleNestedOutputSchema
@ -210,7 +210,7 @@ class CertificateEditInputSchema(CertificateSchema):
def enforce_notifications(self, data): def enforce_notifications(self, data):
""" """
Add default notification for current owner if none exist. 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. Old owner notifications are retained unless explicitly removed later in the code path.
:param data: :param data:
:return: :return:

View File

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