-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#2286 missing e-mail subject personalisation errors #2290
Conversation
6cc0454
to
ad52588
Compare
message = 'Missing personalisation: {}'.format(', '.join(template_object.missing_data)) | ||
def check_placeholders(utils_template_instance): | ||
if utils_template_instance.missing_data: | ||
message = 'Missing personalisation: {}'.format(', '.join(utils_template_instance.missing_data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: since we are here, can we just convert this to f-string format?
message = 'Missing personalisation: {}'.format(', '.join(utils_template_instance.missing_data)) | |
message = f"Missing personalisation: {', '.join(utils_template_instance.missing_data)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, given that the substitution is an expression and not just a variable, I think it's more readable with "format."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with one small nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved - cross reference with AC
ff9a3d6
to
733f7d3
Compare
Description
These changes add unit tests and pull in an updated version of Utils. (See the Utils PR.) The goal is that requests to send e-mail using a template with a placeholder in the subject return 400 if the POST data doesn't contain an associated value. The problem was that Utils was only checking for missing values in the content body.
How Has This Been Tested?
I repeated that steps in the ticket to reproduce the problem and observed that it's no longer a problem.
Happy path with template
![image](https://private-user-images.githubusercontent.com/5375929/410524440-e6c1019d-9fba-4e25-bf8d-766c1a617753.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjQzNjgsIm5iZiI6MTczOTI2NDA2OCwicGF0aCI6Ii81Mzc1OTI5LzQxMDUyNDQ0MC1lNmMxMDE5ZC05ZmJhLTRlMjUtYmY4ZC03NjZjMWE2MTc3NTMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDg1NDI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODhjNTBmNmVhMjNkNGU3YmMwZTYzOGEyNmJhOWNhN2U1MWMzYTM5YWY4NzFjM2UxNzU0YzgyZTc5ZjkwOGFhZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.G64zYiIBmTNJaIVaqCxuockVpEsxlxByeyOZ6KKe2mM)
b2c9ff49-b37b-4352-ab0c-3d3d0710fe4c
:Missing subject data:
![image](https://private-user-images.githubusercontent.com/5375929/410524895-a01c997c-79fb-445f-93b2-57eca0a76dd9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjQzNjgsIm5iZiI6MTczOTI2NDA2OCwicGF0aCI6Ii81Mzc1OTI5LzQxMDUyNDg5NS1hMDFjOTk3Yy03OWZiLTQ0NWYtOTNiMi01N2VjYTBhNzZkZDkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDg1NDI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDEyNjI4OTRlYTBkNDgyNTY4MzA0ZGE4MzNhYWFiYzg0ZDNjNmFlMTY5MTJkZWZhNzk1ZmY4Nzg3YWJhN2QyMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.SiWyRki91L0veIKuKvhREE3P212-wI8_lrCQ8snsubc)
Missing content data:
![image](https://private-user-images.githubusercontent.com/5375929/410525114-8012c412-12bc-458d-8bb6-4bcdb049998d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjQzNjgsIm5iZiI6MTczOTI2NDA2OCwicGF0aCI6Ii81Mzc1OTI5LzQxMDUyNTExNC04MDEyYzQxMi0xMmJjLTQ1OGQtOGJiNi00YmNkYjA0OTk5OGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDg1NDI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2NiNWJmOGRjYjNjMDhjMzRkNzM3ODlhM2Q0ZWU4ZmNkYmM1MGRlNDMxYmY5MzBiNGRjN2UyNjQxOTM2MWFmNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.mKqQg8tESu9xiA4esex6PAJs6rvnLUzp-hSD3ZXzp60)
Missing subject data with template
![image](https://private-user-images.githubusercontent.com/5375929/410526274-956bf76c-6436-4296-9fa2-f7132fa43c28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjQzNjgsIm5iZiI6MTczOTI2NDA2OCwicGF0aCI6Ii81Mzc1OTI5LzQxMDUyNjI3NC05NTZiZjc2Yy02NDM2LTQyOTYtOWZhMi1mNzEzMmZhNDNjMjgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDg1NDI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2Y4NzdlOThkNDcyNTdhZTZlMTMwNjc0ZjM4ZDcxNzJjNWU5OTQ1MzJhNjdhYTdkNDAzNjliZGU1NmQwYThhMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.S8UEwayCTTgRb0vptmZjxXb-carl4njWSTTBdRzJpNI)
64b0953c-b7ea-4b48-b70f-d242ce5b17d2
, which only has a placeholder in the subject:Checklist