#3753: Allow TEMPLATE_STRING_IF_INVALID to contain a placeholder for the missing
variable's name
-----------------------------------------------------------+----------------
Reporter: Matt McClanahan <[EMAIL PROTECTED]> |
Owner: adrian
Status: new |
Component: Template system
Version: SVN |
Resolution:
Keywords: Template, debug, TEMPLATE_STRING_IF_INVALID |
Stage: Accepted
Has_patch: 1 |
Needs_docs: 0
Needs_tests: 1 |
Needs_better_patch: 1
-----------------------------------------------------------+----------------
Changes (by mtredinnick):
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Design decision needed => Accepted
Comment:
Matt,
This sounds reasonable. A few changes to the existing patch(es) I'd like
to see:
1. Needs a test or two.
2. Just check if {{{'%s' in TEMPLATE_STRING_IF_INVALID}}}, rather than
doing the count() call. If there's more than one format string in that
string, it's okay to error out, since that's a developer error that they
can easily fix as part of the debugging cycle. So check if '%s' is in the
string, then do the substitution if so. Python will raise an error anyway
if you include more than one format marker ("not enough arguments for
format string"), so you don't need to do anything extra there.
3. You might want to consider setting a module variable to indicate if
the format string is present. Settings values shouldn't ever change (it's
a bug if they do), so checking it once and storing the result in a flag
for subsequent times will be a performance improvement.
If you could make one combined patch for everything when you update the
patch, that would be cool. Also consider including a patch for AUTHORS so
that I don't have to try and spell your name correctly.
--
Ticket URL: <http://code.djangoproject.com/ticket/3753#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---