Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30837 closed Cleanup/optimization (wontfix)

Changing password reset email template name to .txt extension

Reported by: Thijs Baaijen Owned by: nobody
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Thijs Baaijen)

Hi there,

A minor issue that's been bothering me.
I'd like to make a case to change the default value of email_template_name of the PasswordResetView from

'registration/password_reset_email.html'

to

'registration/password_reset_email.txt'

Reason:
The extension ".html" seems to indicate that an html email is being sent, while it is actually a text email. I think this is confusing, especially to new developers. It makes you think at first that the email being sent wil be rendered to html, until you realize that you need to specify html_email_template_name for that.

Solutions:
If you'll agree, I've created a pull request for this tiny code change.
https://github.com/django/django/pull/11869
I can also see that changing this value now will cause a TemplateDoesNotExist error on existing installations.
Therefore I've created another pull request that fallsback to the .html variant if the template results in a TemplateDoesNotExist error.
https://github.com/django/django/pull/11870
Please let me know what you think of my proposed solutions.

Cheers,

Thijs

Change History (3)

comment:1 by Thijs Baaijen, 5 years ago

Description: modified (diff)

comment:2 by Thijs Baaijen, 5 years ago

Easy pickings: set

comment:3 by Carlton Gibson, 5 years ago

Resolution: wontfix
Status: assignedclosed

Hi. Thanks for the suggestion.

I kind of feel where you're coming from but, I'm going to say wontfix here. The improvement is simply not worth the breaking change, in existing projects and third-party apps.

There's no simple enough way to detect if the old .html template had been overridden, and output a warning in that case. Possible certainly, but not worth the complication.
(Since we'd be shipping the .txt, catching a TemplateDoesNotExist wouldn't work, for example.)

I think this is confusing, especially to new developers.

Yes, maybe a little bit. I guess I'd just say here that, coming out the other side, we all learn something about template loading. (At least that the file extension isn't actually significant in most cases...) Perhaps suboptimal, but, I can't see a way round it now (that's worth the churn at least).

Thanks again.

Version 0, edited 5 years ago by Carlton Gibson (next)
Note: See TracTickets for help on using tickets.
Back to Top