Commit Graph

339 Commits

Author SHA1 Message Date
Chris Beaven 0e54c23caf Fixed #17660 -- Standardize extends tag token parsing
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17568 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-21 02:59:05 +00:00
Aymeric Augustin 2000f375cd Fixed #17675 -- Changed the implementation of the {% regroup %} template tag to use the context properly when resolving expressions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17522 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-14 21:29:50 +00:00
Adrian Holovaty 086697b231 Fixed loader_tags.py to import token_kwargs from the correct module
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17419 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-02 17:03:32 +00:00
Adrian Holovaty d6d4d60109 Made a tiny performance improvement in the template system's Parser.parse() -- don't look up the global variables TOKEN_TEXT, etc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17400 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-28 01:50:14 +00:00
Adrian Holovaty 234b7e3720 Made a small optimization to the template lexer. There's no need to calculate the len of VARIABLE_TAG_START, et al, each time we create a token.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17399 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-27 23:46:22 +00:00
Julien Phalip 6ae393d74d Fixed #15092 -- Made `{% now %}` work with single-quoted string arguments. Thanks to ninja_otoko for the report and to steveire, Aymeric Augustin and Claude Paroz for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17391 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-24 08:02:34 +00:00
Ramiro Morales c5dcba4159 Made dictsort and dictsort reversed template filters fail silently
when passed list of things that aren't dictionaries.

Thanks Harris Lapiroff for the report and Daniel Barreto for the patch.

Fixes #15652.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-15 02:01:21 +00:00
Aymeric Augustin e5719b203c Fixed #17496 -- Regression in the floatformat template filter, introduced by the fix for #15789.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17335 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-03 13:09:12 +00:00
Aymeric Augustin 27444618f6 Fixed #15789 -- Set the decimal precisio to avoid an exception in the floatformat filter, and added a few more tests. Thanks akaihola for the report, igalarzab for the patch and ptone for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-30 14:35:29 +00:00
Aymeric Augustin fa226cd740 Fixed #17303 -- Ensured the list of template loaders is fully loaded before it is cached. Thanks andrey DOT gtx AT gmail DOT com for the report and patch, and Anssi Kääriäinen for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-30 12:55:08 +00:00
Aymeric Augustin 4c445fdfaa Fixed #17110 -- Mentionned that the {% filter %} tag doesn't support the 'safe' and 'escape' filters. Thanks benspaulding.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17271 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-24 20:45:58 +00:00
Adrian Holovaty 20c8aa2a20 Fixed various dodgy behaviours
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17226 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-17 17:37:24 +00:00
Aymeric Augustin a4e516b593 Fixed #11166 -- {% widthratio %} should return 0 when the maximum is 0, no matter the value.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17224 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-17 10:27:14 +00:00
Adrian Holovaty 286c5c811b Fixed #17233 -- Fixed typo in defaultfilters.py docstring. Thanks, aalexapolsky
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-17 02:27:00 +00:00
Aymeric Augustin 19cbdf8c8f Fixed #17348 -- Implemented {% elif %}. Refs #3100.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-09 22:13:27 +00:00
Aymeric Augustin 959f78b3c6 Fixed #3100 -- Added support for arguments on intermediate tag tokens.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-09 22:10:52 +00:00
Aymeric Augustin 33bb3cd47c Fixed #17343 -- Changed the {% now %} tag to use the current time zone when time zone support is enabled. Thanks oinopion for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-04 22:11:12 +00:00
Aymeric Augustin c5a899b190 Fixed #16787 -- Restored the ability to {% load %} template tags libraries within packages. Thanks Ivan Sagalaev for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-21 10:28:12 +00:00
Jannis Leidel 6f66b55108 Fixed #17255 -- Removed "as" prefix from new timezone template filter names for the sake of clarity. Cheers to Aymeric Augustin for bearing with me.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17107 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-18 15:00:08 +00:00
Aymeric Augustin 9b1cb755a2 Added support for time zones. Thanks Luke Plant for the review. Fixed #2626.
For more information on this project, see this thread:
http://groups.google.com/group/django-developers/browse_thread/thread/cf0423bbb85b1bbf



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-18 13:01:06 +00:00
Aymeric Augustin d17bc72880 Fixed #17135 -- Made it possible to use decorators (like stringfilter) on template filter functions in combination with auto-escaping. Refs #16726.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17056 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-30 07:32:21 +00:00
Aymeric Augustin 0a1a9b71fa Made the defaultfilters tests run on the actual filters, not on functions imported from django.utils.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-29 15:28:44 +00:00
Aymeric Augustin 52c66a21e1 Used the decorator syntax consistently to register template filters.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-29 14:51:43 +00:00
Aymeric Augustin 69eadc7f15 Used the decorator syntax consistently for stringfilter. Fixed linebreaks that was decorated twice.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17050 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-29 14:39:02 +00:00
Julien Phalip 26698bc851 Fixed #14806 -- Added support for contextual translations to the `trans` and `blocktrans` template tags. Thanks to jtiai for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-19 04:59:47 +00:00
Alex Gaynor 544a8372fd Remove several more relative imports.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-17 16:56:18 +00:00
Alex Gaynor 3e940cdfd9 Simplify some code to have one loop, rather than two.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-11 20:43:11 +00:00
Alex Gaynor e35ba97740 Change some string literals to be unicode, because:
* It's the most micro of optimizations (forget I even said it)
    * It makes significantly more sense semantically, given these are functions which return unicode.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-11 17:36:05 +00:00
Luke Plant 10d90cba83 Fixed #16935 - misleading message if AttributeError escapes during SimpleTemplateResponse.render
Thanks to isagalaev for the report.

As discussed on django-devs, this reverts some of the changes in [16568]
i.e.  the addition of `SimpleTemplateResponse.__getattr__`, because this
makes it much harder to debug the common case of an AttributeError somewhere
during the rendering of a SimpleTemplateResponse.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16917 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-30 11:46:23 +00:00
Julien Phalip 8137027fd7 Fixed #13956 -- Enabled `*args` and `**kwargs` support for `simple_tag`, `inclusion_tag` and `assignment_tag`. Many thanks to Stephen Burrows for the report and initial patch, to Gregor Müllegger for the initial tests, to SamBull for the suggestions, and to Jannis Leidel for the review and PEP8 cleanup.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-27 12:15:15 +00:00
Julien Phalip 482388cd61 Fixed #16927 -- Corrected the `{% ifchanged %}` template tag's documentation. Thanks to sebastian for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-25 05:21:29 +00:00
Carl Meyer 75199e8f6d Fixed #16866 -- Clearer error message if empty list is passed to select_template. Thanks Silver_Ghost for report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16861 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-21 14:20:18 +00:00
Julien Phalip 436aeb6e15 Fixed #16676 -- Corrected the behavior of the 'add' template filter to return an empty string instead of the given value unchanged in the case of an invalid use. Thanks to dtrebbien for the report and to Aymeric Augustin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16851 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-18 08:33:39 +00:00
Carl Meyer 4397c587a4 Fixed #16770 -- Eliminated TemplateSyntaxError wrapping of exceptions. Thanks to Justin Myles-Holmes for report and draft patch.
Exceptions raised in templates were previously wrapped in TemplateSyntaxError
(in TEMPLATE_DEBUG mode only) in order to provide template source details on
the debug 500 page. The same debug information is now provided by annotating
exceptions rather than wrapping them. This makes catching exceptions raised
from templates more sane, as it's consistent in or out of DEBUG, and you can
catch the specific exception(s) you care about rather than having to also catch
TemplateSyntaxError and unwrap it.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-16 01:16:25 +00:00
Carl Meyer ce48e8e940 Fixed #16848 - Adjusted SimpleTemplateResponse.__init__ to be less brittle.
Could have reverted r16830 instead, but HttpResponse shouldn't have to dance
around and do non-obvious things to keep TemplateResponse happy,
TemplateResponse should be robust against the possibility that
HttpResponse.__init__ might set self.content.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-15 07:26:35 +00:00
Alex Gaynor 8e1226b4a0 Kill some more dead code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 22:46:44 +00:00
Alex Gaynor dafb4951a7 Make a comment more accurate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 19:45:16 +00:00
Chris Beaven f85b96121a Fix a small thread safety issue in ExtendsNode. No tests, but Malcolm said that's ok, honest.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-27 04:55:02 +00:00
Malcolm Tredinnick b9244cfb89 Silenced a "classic division" warning in floatformat template filter.
Fixes #16514. Thanks, Mike Blume.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16649 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-22 08:06:52 +00:00
Jannis Leidel 958e049d4d Fixed #5831 -- Made sure the ForNode reports the correct source of an exception happening in one of the loops. Thanks, Charmless and vladmos.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16605 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-12 14:15:17 +00:00
Jannis Leidel 343b4f1ea5 Fixed #14288 -- Fixed linebreaksbr template filter to normalize newlines first. Thanks, Julien Phalip.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-29 10:22:25 +00:00
Jannis Leidel 5fffe574bd Fixed #16326 -- Fixed re-pickling of unpickled TemplateResponse instances. Thanks, natrius and lrekucki.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16568 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-29 09:40:50 +00:00
Jannis Leidel afd8a47df7 Fixed #16510 -- Actually added new truncatechars filter to the builtins and fixed a typo. Thanks, timdumol.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16550 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-25 09:19:47 +00:00
Jannis Leidel 3b77458371 Fixed #5025 -- Add a "truncatechars" template filter. Many thanks to Chris Beaven.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-14 13:47:10 +00:00
Jannis Leidel 24f4764a48 Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00
Jannis Leidel a1991e37f4 Fixed #16200 -- Stopped TemplateIfParser from returning something in `__init__`. Thanks, traff.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16410 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-16 16:33:47 +00:00
Jannis Leidel 0ebaf10258 Fixed #11989 -- Allow passing a Template instance to inclusion_tag. Thanks to Jeremy Dunck and tcoenen.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 16:22:45 +00:00
Jannis Leidel d27f909d2e Fixed #12847 -- Added name parameter to simple_tag, assignment_tag and inclusion_tag helpers. Thanks, vladmos.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16373 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 16:05:28 +00:00
Ramiro Morales afca4e9349 Tweaked some changes from [16283] to fix failures in i18n and defaultfilters regression tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16286 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-27 17:05:16 +00:00
Alex Gaynor 69cfee2f16 Moved a bunch of imports in the defaultfilters library out of functions. On CPython this is actually a big performance win if one of these filters is your bottleneck.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-27 04:22:37 +00:00