Commit Graph

103 Commits

Author SHA1 Message Date
Gary Wilson Jr 7805afffd7 Fixed #10667 -- Added missing sys import.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 07:23:50 +00:00
Gary Wilson Jr 3e7f5131a5 Fixed #9065 -- Fixed the `timesince` and `timeuntil` template tags to work when both values involved are date objects, thanks to morty and mboersma for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 21:32:34 +00:00
Gary Wilson Jr 86c5142461 Fixed #10094 -- Fixed the `include` and `extends` template tags to work with filenames with spaces, patch from mcroydon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 20:30:28 +00:00
Gary Wilson Jr 432f7f624a Fixed #8462 -- Made `length` and `length_is` template filters fail silently when given a value that has undefined length and added tests for both filters. Based on patch from marcelor, rob, and SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 16:46:27 +00:00
Gary Wilson Jr a6d7b418de Made the template tests error output a bit more pretty.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10191 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 16:05:57 +00:00
Gary Wilson Jr 4a9b1f7a36 Removed an inadvertent raise statement added in [8777] and added the printing of tracebacks for template tests that raise an unhandled exception.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10183 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-29 23:33:01 +00:00
Malcolm Tredinnick 2c6c60cec6 Template filters now pass numerical arguments through as numbers.
This was the (undocumented) behaviour prior to r10118 and now it's back
again. It's neither hard nor harmful to maintain compatibility with the
old ways.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-25 03:45:56 +00:00
Malcolm Tredinnick 7db24dd2b0 Fixed #5756, #6296 -- Most template tags can now handle filters in arguments.
Most of the hard work for this was done by akaihola.

There are still possibly some problems with the i18n template tags,
since they are written quite differently and a few other bug fixes have
to made before they can be fixed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 09:42:51 +00:00
Malcolm Tredinnick a6f429e37e Added consistent support for double- and single-quote delimiters in templates.
Some template filters and tags understood single-quoted arguments, others
didn't. This makes everything consistent. Based on a patch from akaihola.

Fixed #7295.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 09:40:25 +00:00
Malcolm Tredinnick f5c07f89e3 Removed an invalid template test (translating an empty string is a bad idea).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 09:19:45 +00:00
Malcolm Tredinnick dfddf129f0 Fixed #9701 -- Added a "safeseq" template filter.
This is like "safe", except it operates on the individual elements of a
sequence, rather than treating the whole argument as a string.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-02 08:16:33 +00:00
Malcolm Tredinnick 152d517878 Fixed a misnamed test that was inadvertently hiding an earlier one.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9929 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 06:54:38 +00:00
Jacob Kaplan-Moss bd2b0059be Here's the rest of [9530] where I actually rename the tag like I said I did. I swear this was git's fault, not mine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-24 22:33:32 +00:00
Jacob Kaplan-Moss 4aa97f5c18 Fixed #6398: added an optional `{% empty %}` clause to the `{% for %}` template tag. The contents of this clause are rendered if the list iterated over turns out to be empty. Thanks, Jannis Leidel.
Astute readers will notice that the patch originally called this `default`; after consideration I decided that `empty` is a very slightly better color for this particular bikeshed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9530 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-24 22:01:48 +00:00
Malcolm Tredinnick 0349d83289 Fixed #6948 -- The join filter was escaping the literal value that was
passed in for the connector. This was contrary to what the documentation
for autoescaping said and to what every other filter does with literal
strings as arguments.

This is backwards incompatible for the situation of the literal string
containing one of the five special HTML characters: if you were writing
{{ foo|join:"&" }}, you now have to write {{ foo| join:"&" }}.
Previous behaviour was, as noted, a bug and contrary to what was
documented and expected.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9442 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-15 01:16:20 +00:00
Karen Tracey 2026934600 Fixed #8966 -- Changed is_safe for length_is filter to False, since its return value is a boolean, not a string.
Thanks Thomas Steinacher and carljm.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9291 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-28 19:00:49 +00:00
Malcolm Tredinnick 8fb1459b52 Added some better error reporting and path handling when creating template 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-10-06 06:34:54 +00:00
Malcolm Tredinnick d343aa3022 Altered a failing url template tag test to work more reliably.
There's no guarantee about the order in which ambiguous patterns are resolved.
The solution is "don't do that" and avoid ambiguity.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-05 04:59:55 +00:00
Malcolm Tredinnick 7838493b9e Fixed #8726 -- When doing reverse URL resolving, make sure we're consistently
dealing with unicode strings throughout by promoting up from UTF-8 as necessary.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 22:47:25 +00:00
Jacob Kaplan-Moss 86316f0be6 Fixed #7027: template tags now corectly break tokens around strings marked for translation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 18:28:06 +00:00
Malcolm Tredinnick 6390155f5c Added a couple of extra tests to ensure url tag robustness. These are an
attempt to verify #8726.

Refs #8726.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8766 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 17:29:49 +00:00
Malcolm Tredinnick a63a83e5d8 A rewrite of the reverse URL parsing: the reverse() call and the "url" template tag.
This is fully backwards compatible, but it fixes a bunch of little bugs. Thanks
to SmileyChris and Ilya Semenov for some early patches in this area that were
incorporated into this change.

Fixed #2977, #4915, #6934, #7206.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 11:11:20 +00:00
Jacob Kaplan-Moss f2d7ee759a Fixed #8710: removed a few stray tabs. Thanks, gkelly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8746 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-30 19:25:40 +00:00
Jacob Kaplan-Moss c068bc184c Merge branch 'url-tag-asvar'
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8716 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 19:28:03 +00:00
Malcolm Tredinnick 3111d7f60b Fixed #7201 -- Fixed the timeuntil filter to work correctly with timezone-aware
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-26 08:08:55 +00:00
Malcolm Tredinnick 8c4a525871 Fixed #7177 -- Added extra robustness to the escapejs filter so that all
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-26 07:56:32 +00:00
Malcolm Tredinnick b46e736c9a Because the filter tests take non-zero time to pass, it's possible for one of
the timeuntil tests to fail because the pre-recorded "now" has moved on
sufficiently far from actual "now()". Fixed the one test that was failing for
me (the other timeuntil and timesince tests already have a small buffer built
in to guard against this problem).

The problem was revealed after [8535].


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 20:47:42 +00:00
Russell Keith-Magee 06d49768bd Fixed #7743: Reverted [8483], which was itself a reversion of [8481], after 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-25 12:31:10 +00:00
Malcolm Tredinnick c46bb219bf Fixed #7460 -- Made the "cache" template tag always generate keys that can be
used with the memcache backend (which has the strongest restriction on keys).
Based on a patch from trbs.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8533 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 04:52:55 +00:00
Russell Keith-Magee 67402a6fb5 Reverted [8481] and [8482] while we work out what is going on with #8453 and 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-23 15:03:40 +00:00
Russell Keith-Magee b35acb3ee9 Corrected a test case error mistakenly committed in [8481].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 13:14:10 +00:00
Russell Keith-Magee 46da8ac9e5 Fixed #7443: 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@8481 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 12:52:04 +00:00
Gary Wilson Jr 6d863fef8a Fixed #5270 -- Allow template tags and filters to accept an emtpy string, patch from jdunck.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 21:08:11 +00:00
Luke Plant c768bc6f25 Fixed #8031 - url tag no longer silences NoReverseMatch exceptions since this is very rarely useful
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-05 14:16:13 +00:00
Malcolm Tredinnick f752f69238 Fixed #7767 -- Fixed template egg loading test for Windows systems.
Thanks, Ramiro Morales.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8135 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 06:05:15 +00:00
Malcolm Tredinnick e29aece743 Fixed #4534 -- Added an "else" option to the "ifchanged" template tag.
Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8095 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 22:09:43 +00:00
Adrian Holovaty 74f0408fa2 Fixed #6201 -- Improved the {% cache %} template tag to allow the timeout to be a template variable. Inspired by the patch by zz and edrik
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7754 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 04:54:10 +00:00
Adrian Holovaty 5ee4a099f1 Fixed infuriating lack of apostrophe in a comment
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 04:33:18 +00:00
Adrian Holovaty dbde7fc8b0 Fixed #6322 -- Fixed bug in 'ifchanged' template tag where it wasn't 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-26 04:30:06 +00:00
Adrian Holovaty 65437a95e1 Improved our tests so that they don't raise an error if setuptools isn't installed, hence ridding the test suite of all dependencies. Also updated docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7751 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 04:25:40 +00:00
Adrian Holovaty 345a096756 Negligible formatting changes to tests/regressiontests/templates/loaders.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 04:22:12 +00:00
Russell Keith-Magee 4317ba5799 Fixed #7318 -- Cleaned up the template inheritance logic, specifically to 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-18 12:59:39 +00:00
Jacob Kaplan-Moss 08d468db92 Fixed a messy test case (regressiontests/templates/loaders) that could cause future tests to fail by not cleaning up after itself.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7567 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-30 23:24:23 +00:00
Russell Keith-Magee d53e8f1285 Fixed #6430 -- Corrected the loading of templates from eggs, which was 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-29 13:11:23 +00:00
Malcolm Tredinnick 0c4ea9b922 Fixed #6279, #6514 -- Fixed some HTML escaping problems in the urlize filter.
Based on a patch from SmileyChris with some test additions from Rob Hudson.
Thanks, both.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7079 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-03 08:54:26 +00:00
Malcolm Tredinnick d18a114f86 Fixed #6326 -- Made the test for translations of filter arguments test something that has a chance of failure. Thanks akaihola.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-03 01:49:55 +00:00
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