Opened 18 years ago
Closed 14 years ago
#3579 closed (invalid)
remove admin's reliance on TEMPLATE_STRING_IF_INVALID set to empty string
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | template admin | |
Cc: | hv@…, Marinho Brandão | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Refactor the way TEMPLATE_STRING_IF_INVALID
works, rather than special-case it for the admin site.
It's often useful to have something like "BADDATA" assigned to TEMPLATE_STRING_IF_INVALID
during development and testing, because it's easy to to scan for unforseen side effects, both visually and by a text search.
Attachments (5)
Change History (27)
comment:1 by , 18 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Sorry, I was referring to this thread: http://tinyurl.com/2nxu98
A better way to phrase the issue?
Refactor the way TEMPLATE_STRING_IF_INVALID
works, without special-casing it for the admin site.
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
Could you please point out where the special-casing exists in the admin.
comment:4 by , 18 years ago
http://www.djangoproject.com/documentation/templates_python/#how-invalid-variables-are-handled
"Many templates, including those in the Admin site, rely upon the silence of the template system when a non-existent variable is encountered."
comment:5 by , 18 years ago
Component: | Core framework → Template system |
---|---|
Triage Stage: | Design decision needed → Accepted |
Ok, this was just pointed out to me. Feel free to provide suggestions and/or patches. Marking accepted as per Adrian's comments in the mailing list post.
comment:6 by , 18 years ago
Here is one case where the admin relies on an empty string:
http://groups.google.com/group/django-developers/browse_thread/thread/4af39afa4600bacc/f065cdd1ad2e6158
comment:7 by , 18 years ago
Summary: | decouple TEMPLATE_STRING_IF_INVALID → remove admin's reliance on TEMPLATE_STRING_IF_INVALID set to empty string |
---|
by , 17 years ago
All fixes: two for action="{{ form_url }}", two for <th{{some.stuff}}>
by , 17 years ago
Attachment: | all.2.patch added |
---|
All fixes: two for action="{{ form_url }}", two for <th{{some.stuff}}>
by , 17 years ago
Attachment: | all.3.patch added |
---|
All fixes: two for action="{{ form_url }}", two for <th{{some.stuff}}>, one for <td{{some.stuff}}
comment:9 by , 17 years ago
related but not closed tickets:
http://code.djangoproject.com/ticket/3073 [hack for output, giving empty form_url]
http://code.djangoproject.com/ticket/2583 [no patch, only long bug description]
comment:11 by , 17 years ago
Please demonstrate some patience. You may have noticed that this isn't the only ticket in Trac and it isn't the highest priority item at the moment. When we have time, it will be reviews and you'll get some feedback on what remains to be done.
comment:13 by , 17 years ago
Cc: | added |
---|
comment:14 by , 16 years ago
Cc: | added |
---|
by , 16 years ago
Attachment: | 3579_4.patch added |
---|
Added template conditionals for sometimes-non-existing variables in admin, r8445.
comment:15 by , 16 years ago
milestone: | → 1.0 maybe |
---|
comment:16 by , 16 years ago
milestone: | 1.0 maybe → post-1.0 |
---|
follow-up: 19 comment:17 by , 16 years ago
milestone: | post-1.0 → 1.0 maybe |
---|
I'm not understanding why this ticket is being considered to post-1.0 if it is (I think) the cause to bugged add-user form and others strange behaviours everytime a variable isn't valid in the template.
For example: a simple /admin/auth/user/add/
is rendering this code:
<form action="<font color='red'>form_url</font>" method="post" id="user_form"> <div>
Shouldn't this enought reason to consider this ticket?
Maybe would make it safe string or disabling this "helper" (that isn't helping nothing).
comment:18 by , 16 years ago
milestone: | 1.0 maybe → post-1.0 |
---|
Making a change like this now (in feature freeze) would be destabilising, at a minimum.
Seriously, when a core maintainer triages something as post-1.0, please don't decide that you should change that. we have a mailing list if you want to ask for a reconsideration, but this isn't even borderline. It's an enhancement request that can easily be added afterwards.
comment:19 by , 16 years ago
Replying to marinho:
For example: a simple
/admin/auth/user/add/
is rendering this code:
<form action="<font color='red'>form_url</font>" method="post" id="user_form">
<div>
When TEMPLATE_STRING_IF_INVALID is empty (by default), there's no such problem.
Also it is said in the docs that
While TEMPLATE_STRING_IF_INVALID can be a useful debugging tool, it is a bad idea to turn it on as a ‘development default’. Many templates, including those in the Admin site, rely upon the silence of the template system when a non-existent variable is encountered. If you assign a value other than '' to TEMPLATE_STRING_IF_INVALID, you will experience rendering problems with these templates and sites.
at http://www.djangoproject.com/documentation/templates_python/#how-invalid-variables-are-handled
Admin interface templates are relying on this behavior now in few last places. Patch for them is attached.
comment:22 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
I think it is now too late to put this genie back in the bottle, and it isn't worth the effort trying to fix the admin or other contrib apps. Given that #3073 was marked as invalid I'm going to do the same here. Please bring to django-devs if you think it is worth the effort to fix this.
Not sure what you mean by special casing for the admin, could you please explain in more detail.