summaryrefslogtreecommitdiff
path: root/django/template
AgeCommit message (Collapse)Author
2008-10-06Added some better error reporting and path handling when creating template ↵Malcolm Tredinnick
paths. We now raise UnicodeDecodeError for non-UTF-8 bytestrings (thanks to Daniel Pope for diagnosing this was being swallowed by ValueError) and allow UTF-8 bytestrings as template directories. Refs #8965. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31Fixed #7027: template tags now corectly break tokens around strings marked ↵Jacob Kaplan-Moss
for translation. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29Merge branch 'url-tag-asvar'Jacob Kaplan-Moss
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8716 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26Fixed #7201 -- Fixed the timeuntil filter to work correctly with timezone-awareMalcolm Tredinnick
times. Patch from Jeremy Carbaugh. This is backwards incompatible in the sense that previously, if you tried to compare timezone-aware and timezone-naive values, you got an incorrect result. Now you get an empty string. So your previously incorrect code returns a different incorrect result. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26Fixed #7177 -- Added extra robustness to the escapejs filter so that allMalcolm Tredinnick
invalid characters are correctly escaped. This avoids any chance to inject raw HTML inside <script> tags. Thanks to Mike Wiacek for the patch and Collin Grady for the tests. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8577 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25Fixed #7743: Reverted [8483], which was itself a reversion of [8481], after ↵Russell Keith-Magee
confirmation from Malcolm. Corrected a long standing mistake in the timesince/timeuntil filters when using a parameter for 'now'. Thanks to Andrew Shearer <ashearerw@shearersoftware.com> for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8535 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23Reverted [8481] and [8482] while we work out what is going on with #8453 and ↵Russell Keith-Magee
the related discussions that I wasn't previously aware of. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23Fixed #7443: Corrected a long standing mistake in the timesince/timeuntil ↵Russell Keith-Magee
filters when using a parameter for 'now'. Thanks to Andrew Shearer <ashearerw@shearersoftware.com> for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8481 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15Fixed #5270 -- Allow template tags and filters to accept an emtpy string, ↵Gary Wilson Jr
patch from jdunck. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-05Fixed #8031 - url tag no longer silences NoReverseMatch exceptions since ↵Luke Plant
this is very rarely useful git-svn-id: http://code.djangoproject.com/svn/django/trunk@8211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01Fixed #3912 - Added simple type checking to template.Context.update() to ↵Luke Plant
help debugging broken context processors. Thanks Jeremy Dunck git-svn-id: http://code.djangoproject.com/svn/django/trunk@8181 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26Fixed #4534 -- Added an "else" option to the "ifchanged" template tag.Malcolm Tredinnick
Patch from SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8095 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26Fixed #7417 -- Fixed ReST error in do_if() docstring. Thanks, Richard Bell ↵Adrian Holovaty
<rbell01824@earthlink.net> git-svn-id: http://code.djangoproject.com/svn/django/trunk@7758 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26Optimized {% cycle %} template tag so that it creates the Variable objects ↵Adrian Holovaty
in CycleNode.__init__() rather than each time render() is called git-svn-id: http://code.djangoproject.com/svn/django/trunk@7756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26Fixed #6322 -- Fixed bug in 'ifchanged' template tag where it wasn't ↵Adrian Holovaty
resetting itself properly in some cases. Thanks, nedbatchelder git-svn-id: http://code.djangoproject.com/svn/django/trunk@7752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-18Fixed #7318 -- Cleaned up the template inheritance logic, specifically to ↵Russell Keith-Magee
handle the case where the parent template has no template tags/blocks. Took the opportunity to optimize the logic a little. Thanks to Matthias Kestenholz <mk@spinlock.ch> for the original report and test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-06Fixed #7293 -- Corrected some doctests strings internal to the template ↵Russell Keith-Magee
module. Thanks, akaihola. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29Fixed #6430 -- Corrected the loading of templates from eggs, which was ↵Russell Keith-Magee
broken by the unicode merge. Thanks for the excellent report and patch, Juan Manuel Caicedo <juan.manuel.caicedo@gmail.com>. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7565 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29Fixed #6950 -- Modified initialization of template loaders to use a ↵Russell Keith-Magee
temporary variable instead of directly modifying the global loader list. Thanks, mrts. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29Fixed #7301 -- Corrected minor typo in docstring. Thanks, micahcowan.Russell Keith-Magee
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7557 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20FIxed #6513 -- Handle overflows better in the floatformat filter. It's notMalcolm Tredinnick
possible to test this automatically everywhere due to differing representations on different platforms. Manual testing confirms it works, though. Thanks, Karen Tracey. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17Fixed #5884 -- Added better display error handling for template variables.Malcolm Tredinnick
Combined work from Karen Tracey and Thomas Güttler. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7260 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-25Fixed #5701 -- Fixed decorators to take the name, attributes, and docstring ↵Gary Wilson Jr
of the function they decorate by adding a modified version of the `functools.wraps` function from Python 2.5. `wraps` has been altered to work with Django's `curry` function and with Python 2.3, which doesn't allow assignment of a function's `__name__` attribute. This fixes severaly annoyances, such as the online documentation for template filters served by the admin app. This change is backwards incompatible if, for some reason, you were relying on the name of a Django decorator instead of the function it decorates. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7153 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-05Tweaked [7082] and [7084] a little bit to also allow comment nodes prior to ↵Malcolm Tredinnick
the extends tag. This would be little less fiddly if we knew nodelist were always of type NodeList, but they could be normal lists. Or if we merged successive TextNodes, instead of appending them. Something to think about going forwards. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04Fixed a simple TODO item in one error path of the "extends" tag.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7085 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04Fixed #5124 -- Added a reasonable error when "extends" is not the first ↵Malcolm Tredinnick
template tag. Patch from k0001. Refs #6274. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04Allow whitespace prior to an "extends" tag. This allows a little more ↵Malcolm Tredinnick
formatting flexibility. Refs #6274. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7082 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-28Fixed #6471 -- Fixed stringfilter decoration of `force_escape` filter.Gary Wilson Jr
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-06Fixed #5567 -- Added a "last" filter. Based on a patch from darkpixel.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6998 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-06The "first" filter can return an unsafe string for safe input ( ↵Malcolm Tredinnick
{{"&lt;"|first}} ), so change is_safe to False. Refs #5567. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-05Reverted 'regroup' template tag changes from [6956], as they caused bug ↵Adrian Holovaty
#6271, which affects one of my sites. I don't have time to inspect the #6271 patch, so I'm reverting this change in the interim, to fix the bug immediately. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-02Fixed #6295 -- Made the {% for %} tag a bit more efficient by creating a ↵Adrian Holovaty
single context dictionary rather than recreating it each time through the loop. Thanks, Ned Batchelder git-svn-id: http://code.djangoproject.com/svn/django/trunk@6981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Renamed 'reversed' variable to 'is_reversed' in ForLoop template tag ↵Adrian Holovaty
implementation, to avoid potential conflicts with the 'reversed' built-in and to make the code more obvious git-svn-id: http://code.djangoproject.com/svn/django/trunk@6976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Negligible cleanups to django.template.contextAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6975 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Negligible changes to django.template -- removed a useless docstring, ↵Adrian Holovaty
converted another one to a comment git-svn-id: http://code.djangoproject.com/svn/django/trunk@6974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Removed lexer_factory() and parser_factory() functions in django.template, ↵Adrian Holovaty
simplifying the compile_string() logic git-svn-id: http://code.djangoproject.com/svn/django/trunk@6973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Removed a comment in django/template/__init__.py that suggests we would do ↵Adrian Holovaty
'crazy stack-frame stuff' git-svn-id: http://code.djangoproject.com/svn/django/trunk@6972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Negligible formatting changes to django/template/__init__.py -- fixed some ↵Adrian Holovaty
spacing issues, renamed NotImplemented to NotImplementedError and changed some 'raise' statements to use callable exceptions instead of the old-style comma technique git-svn-id: http://code.djangoproject.com/svn/django/trunk@6971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Changed an '== None' to 'is None' in Template.__init__()Adrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22Moved the various Debug classes in django.template to a new module, ↵Adrian Holovaty
debug.py, so they're only loaded if DEBUG=True. This led to a DEBUG=False memory savings of one 4-KB memory block on my machine, according to ps git-svn-id: http://code.djangoproject.com/svn/django/trunk@6969 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19Removed some reverse string craziness from the regroup template tag argument ↵Gary Wilson Jr
checking and added a few syntax tests. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19Fixed #6239 -- Fixed an auto-escaping problem with urlizetrunc. Thanks, ↵Malcolm Tredinnick
SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-17Small typo fixes. Thanks, jdetaeye, Ionut Ciocirlan, David Reynolds and adamv.Malcolm Tredinnick
Fixed #6123, #6133, #6179, #6194. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6923 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-05Fixed #6132: note to self: when you add new template tags, you need to ↵Jacob Kaplan-Moss
remember to actually register them. Thanks, Ben Walton. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6897 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-04Fixed #4131: added an "escapejs" filter for use in JavaScript strings, and ↵Jacob Kaplan-Moss
updated the documentation on addslashes to point to the new ticket. Featuring contributions from Ned Batchelder, Jeremy Dunck, and Andy Durdin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6892 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02Fixed #4563 -- Context.pop/push/update return the top-level dictionary (the newMalcolm Tredinnick
one for push() and update(), the one removed for pop()). Based on a patch from Brian Harring. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01Edited docs/serialization.txt changes from [6645]Adrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6787 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-30Fixed #6057 -- Mark rendered template output as safe for auto-escaping purposes.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29Fixed #6030 -- More robust error handling for the "float" filter. Thanks,Malcolm Tredinnick
SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29Added tests and a small optimisation for [6721]. Thanks SmileyChris. Fixed #6049Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6729 bcc190cf-cafb-0310-a4f2-bffc1f526a37