Cleaning up a lot of things, getting Enums used everywhere.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2024-02-28 12:40:52 -05:00
parent 0368307802
commit 820ee5a942
30 changed files with 209 additions and 180 deletions

View File

@@ -382,7 +382,7 @@ class TemplateSchema(BaseTemplateSchema, UUIDsAsStringsMixin):
@validates_schema
def validate_type(self, data, **kwargs):
if data.get("template_type") == models.EMAIL_TYPE:
if data.get("template_type") == models.TemplateType.EMAIL:
subject = data.get("subject")
if not subject or subject.strip() == "":
raise ValidationError("Invalid template subject", "subject")
@@ -628,7 +628,7 @@ class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
in_data["template"], in_data["personalisation"]
)
in_data["body"] = template.content_with_placeholders_filled_in
if in_data["template"]["template_type"] != models.SMS_TYPE:
if in_data["template"]["template_type"] != models.TemplateType.SMS:
in_data["subject"] = template.subject
in_data["content_char_count"] = None
else: