Commit Graph

157 Commits

Author SHA1 Message Date
Malcolm Tredinnick a7da12d320 Fixed #5567 -- Added a "last" filter. Based on a patch from darkpixel.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6998 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-06 03:53:33 +00:00
Adrian Holovaty 3d52ce730f Reverted 'regroup' template tag changes from [6956], as they caused bug #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-05 00:03:12 +00:00
Adrian Holovaty 293f0f2360 Fixed #6295 -- Made the {% for %} tag a bit more efficient by creating a 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
2008-01-02 05:01:03 +00:00
Gary Wilson Jr d1b5a0bde5 Removed some reverse string craziness from the regroup template tag argument 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-19 06:11:55 +00:00
Malcolm Tredinnick 367867845f Fixed #6239 -- Fixed an auto-escaping problem with urlizetrunc. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 04:20:02 +00:00
Malcolm Tredinnick 67373009e0 Fixed #4563 -- Context.pop/push/update return the top-level dictionary (the new
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-02 23:57:22 +00:00
Malcolm Tredinnick 8de4ed9c8c Fixed #6057 -- Mark rendered template output as safe for auto-escaping purposes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-30 15:32:01 +00:00
Malcolm Tredinnick 3c272792d6 Added tests and a small optimisation for [6721]. Thanks SmileyChris. Fixed #6049
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6729 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 01:44:30 +00:00
Malcolm Tredinnick 9130765ff9 Fixed #5890 -- fixed the far edge-case of allowing constant strings inside
template template markers: we now treat embedded, escaped double quotes
consistently with constant string arguments to filters. Patch from Dmitri
Fedortchenko.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 21:04:05 +00:00
Malcolm Tredinnick 2e9e36e297 Fixed #5983 -- Made iriencode filter respect safe strings. Patch from
SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6706 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-20 01:37:57 +00:00
Malcolm Tredinnick 5f8cfe99f3 Fixed #5969 -- Corrected a problem introduced in [6682].
*sigh* As usual, the one case I forget to test turned out to be broken.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 03:36:03 +00:00
Malcolm Tredinnick 4bd75e8712 Fixed a couple of chained filter tests that weren't demonstrating what they
claimed (since the "cut" filter's behaviour had changed since I originally
wrote those tests).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6684 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:18:09 +00:00
Malcolm Tredinnick 4585b4d6c2 Fixed some missed auto-escaping and URL quoting cases in the urlize filter.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6683 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:12:40 +00:00
Malcolm Tredinnick adcec0885d Fixed a few problems with variable resolving inside of blocktrans tags. A couple of these were exposed by the auto-escaping changes, but I suspect the other one has been hiding in plain sight for a while.
Fixed #5952, #5953


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:12:18 +00:00
Malcolm Tredinnick 0928fa5566 Fixed #5945 -- Treat string literals in template filter arguments as safe
strings for auto-escaping purposes.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6680 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:11:26 +00:00
Malcolm Tredinnick 0b0ef3f0c5 Fixed #4713 -- Fixed handling of _() in template tag arguments. Based on
patched from Indy and SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 04:04:12 +00:00
Malcolm Tredinnick bdb0b903c2 Content coming via {{ block.super }} is always going to be correctly escaped
already. We mark it as safe so that template authors don't need to.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6673 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14 21:07:27 +00:00
Malcolm Tredinnick 356662cf74 Implemented auto-escaping of variable output in templates. Fully controllable by template authors and it's possible to write filters and templates that simulataneously work in both auto-escaped and non-auto-escaped environments if you need to. Fixed #2359
See documentation in templates.txt and templates_python.txt for how everything
works.

Backwards incompatible if you're inserting raw HTML output via template variables.

Based on an original design from Simon Willison and with debugging help from Michael Radziej.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14 12:58:53 +00:00
Malcolm Tredinnick 91556cf22e Fixed an invalid URL specification.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6618 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-27 06:23:05 +00:00
Malcolm Tredinnick 7ca708140a Fixed #2920 -- Removed _() from builtins.
This is backwards incompatible, but easy to work around.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6582 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-21 17:14:25 +00:00
Malcolm Tredinnick 6fbf653aa5 Fixed #1065 -- Added a "cache" template tag. Thanks, Ian Maurer and, particularly, Nick Lane.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-21 15:48:40 +00:00
Malcolm Tredinnick b678601df3 Fixed #4123 -- Changed the firstof template tag to correctly handle a literal
string as its last argument. Thanks, Wesley Fok and Matt Boersma.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-20 15:01:31 +00:00
Gary Wilson Jr 66203fc9ee Fixed #2675 -- Changed the `timeuntil` and `timesince` template filters to display "0 minutes" when passed a past or future date respectively instead of "-1 years, 12 months". Thanks to nickefford for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-17 04:50:12 +00:00
Russell Keith-Magee 09145d2e5f Fixed #208 -- Modernized the syntax of the cycle tag to allow for spaces and variables in cycle values. Thanks to SmileyChris and Chris McAvoy for their work on this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6153 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 02:49:21 +00:00
Gary Wilson Jr 304381616f Fixed #4952 -- Fixed the `get_template_sources` functions of the `app_directories` and `filesystem` template loaders to not return paths outside of given template directories. Both functions now make use of a new `safe_join` utility function. Thanks to SmileyChris for help with the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-23 04:45:01 +00:00
Russell Keith-Magee 73bec372ee Fixed #4897 -- Fixed minor typo in doctest comment.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-20 12:15:02 +00:00
Malcolm Tredinnick 8c85ddf306 Fixed #4772 -- Fixed reverse URL creation to work with non-ASCII arguments.
Also included a test for non-ASCII strings in URL patterns, although that
already worked correctly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5630 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-07 18:24:27 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Jacob Kaplan-Moss 24512a74be Fixed #1465: added support for regex lookups. Thanks, Tom Tobin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-27 18:58:10 +00:00
Malcolm Tredinnick a5802b35dd Fixed #4453 -- Allow dots in URL pattern names (although the string in that case is first tried as an import path and only then falls back to being treated as a pattern).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5530 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-25 04:34:34 +00:00
Russell Keith-Magee 16269c4d0a Fixed #3523 -- Added list unpacking to for loops in templates. Thanks to SmileyChris and Honza Kral for their work.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-08 11:58:03 +00:00
Malcolm Tredinnick faa31732ca Fixed #3753 -- Allow optional display of invalid variable name in
TEMPLATE_STRING_IF_INVALID. Thanks, Matt McClanahan.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5167 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-08 03:36:16 +00:00
Malcolm Tredinnick d9f1a0aaef Renamed one test to avoid a name-clash with an earlier test of the same name.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5125 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-28 16:41:44 +00:00
Malcolm Tredinnick 54f11ee63c Fixed #4164, #4171 -- Reworked some of the template lexer logic to ensure we
don't get caught out by a couple of corner cases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-27 12:16:22 +00:00
Malcolm Tredinnick 6fe5235cea Renamed filter template tests to be in their own sequence. Makes it easier to
add tests if the related names aren't spread out across creation.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5103 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-27 11:01:45 +00:00
Malcolm Tredinnick aa1b182da3 Fixed #3543 -- Be a bit more tolerant of spaces following the comma
argument separator in the "url" tag.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5077 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-25 10:29:39 +00:00
Malcolm Tredinnick 2a512a4e83 Fixed #3749 -- Set the context correctly when using the "filter" template tag.
Thanks, Zak Johnson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-21 04:44:30 +00:00
Malcolm Tredinnick 539a7ab993 Fixed #4098 -- fixed a syntax error when reporting errors in "with" template
tag. Thanks cephelo@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-21 04:13:52 +00:00
Malcolm Tredinnick d882656ea3 Added the ability to name URL patterns. Helps with disambiguity reverse matches.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-01 07:25:20 +00:00
Russell Keith-Magee 9191fa1f64 Fixed #3532 -- Made spaceless template tag remove all spaces, rather than preserving a single space. Thanks for the suggestion, ampaze@gmx.net.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-01 01:09:21 +00:00
Adrian Holovaty d22e39c10d Fixed #3799 -- Added django.contrib.webdesign and moved 'lorem' template tag into there
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-30 01:50:06 +00:00
Russell Keith-Magee 1f0b1afbfe Fixed #3799 -- Added Lorem template tag for generation of random latin content. Thanks to SmileyChris for the implementation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-29 11:13:20 +00:00
Jacob Kaplan-Moss d6fd9fb22b Fixed #3826: added a {% with %}. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-27 17:25:56 +00:00
Malcolm Tredinnick 8248569471 Fixed #3670 -- Fixed template argument parsing so that it understands negative
floats and integers as numeric types. Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-09 06:12:15 +00:00
Jacob Kaplan-Moss 19e0bf1d44 Fixed #3465: template variable lookups like {{ foobar.13 }} now (correctly) fail silently on unsubscriptable objects. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4639 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-27 20:25:27 +00:00
Malcolm Tredinnick 0fabbf8ce8 Fixed #2606 -- Added tag for working out the URL of a particular view function.
All work done by Ivan Sagalaev.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 04:24:58 +00:00
Malcolm Tredinnick 58ae80b5ea Changed one of the named endblock tests to test that nesting in the wrong order
is caught as an error.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 02:54:17 +00:00
Malcolm Tredinnick a0c354ee4e Fixed #3351 -- Added optional naming of the block in "endblock" tags to ensure
correct nesting. Thanks for the patch, SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-12 00:22:22 +00:00
Adrian Holovaty be217bce53 Template system now supports variables whose str() returns a Unicode object with non-ascii characters. Thanks, gabor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-05 19:48:46 +00:00
Jacob Kaplan-Moss b1b4e8e7c4 Fixed #2800: the ifchanged tag now can optionally take paramaters to be checked for changing (instead of always using the content). Thanks, Wolfram Kriesing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4050 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-07 05:36:51 +00:00
Adrian Holovaty 48234a0925 Fixed #2961 -- Added 'opencomment' and 'closecomment' options to {% templatetag %} templatetag. Thanks for the patch, Jeong-Min Lee
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-27 01:58:13 +00:00
Adrian Holovaty 60b46d72ac Fixed #648 -- Added comment syntax to template system: {# #}. Thanks for the patch, mccutchen@gmail.com and Hawkeye
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3931 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-24 21:30:38 +00:00
Malcolm Tredinnick 9c0568e21e Fixed #2208 -- Allow empty arguments to be passed to filters. Thanks, mattmcc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3852 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-26 07:26:07 +00:00
Malcolm Tredinnick bd4c22be0b Fixed #2454 -- Make "ifchanged" tag work more predictably inside nested
for-loops. Thanks, dummy@habmalnefrage.de.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3800 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-23 09:49:58 +00:00
Malcolm Tredinnick d296e5e565 Fixed #2743 -- Made the value of a cycle tag accessible through the context.
Patch from Martin Glueck.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-21 13:09:00 +00:00
Russell Keith-Magee cfe77946d7 Fixes #2637 -- Clarified handling of TEMPLATE_STRING_IF_INVALID, especially with regards to filtering of invalid values. Modified unit tests to test both empty and non-empty values for TEMPLATE_STRING_IF_INVALID. Thanks to SmileyChris for identifying and helping to resolve this bug.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-04 14:02:11 +00:00
Russell Keith-Magee 97b9ad73b4 Refs #2333 - Modified runtests script to use new testing framework. Migrated existing tests to use Django testing framework. All the 'othertests' have been migrated into 'regressiontests', and converted into doctests/unittests, as appropriate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-27 13:59:47 +00:00