Commit Graph

357 Commits

Author SHA1 Message Date
Luke Plant a92e7f37c4 Changed a lot of internal code to use 'format_html' where appropriate/possible 2012-07-03 22:20:12 +01:00
Claude Paroz da200c5e35 Fixed #16519 -- Deprecated mimetype kwarg of HttpResponse __init__
This keyword was already deprecated in the code (supported for
backwards compatibility only), but never formally deprecated.
Thanks Paul McMillan for the report and yasar11732 for the initial
patch.
2012-06-30 21:27:47 +02:00
Chris Beaven c57ba67331 Fixed #14502 again -- saner verbatim closing token
Previously, the closing token for the verbatim tag was specified as the
first argument of the opening token. As pointed out by Jannis, this is
a rather major departure from the core tag standard.

The new method reflects how you can give a specific closing name to
{% block %} tags.
2012-06-19 10:49:33 +12:00
Luke Plant fd6a9d35d9 IfParser.next() method renamed to avoid confusion with iterator protocol. 2012-06-14 23:12:15 +01:00
Luke Plant edee20ff50 Reverted part of 169b1a40 which was mistakenly applied to a non-iterator class.
Doing next(IfParser()) works for Python 2.7, because it calls
IfParser.next(), but in Python 3 will call IfParser.__next__() which does
not work since it is not an iterator and does not have that method.
2012-06-14 23:12:15 +01:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Aymeric Augustin 4464bbba15 Fixed #14502 -- Added a verbatim template tag.
Thanks SmileyChris for the patch.
2012-06-07 09:59:14 +02:00
Claude Paroz edfa95c22f Specified when open should use binary mode.
Thanks Vinaj Sajip for the help of his django3 branch.
2012-05-25 20:43:43 +02:00
Claude Paroz 169b1a404c Replaced foo.next() by next(foo).
This new syntax for next() has been introduced in Python 2.6 and is
compatible with Python 3.
2012-05-10 20:15:49 +02:00
Claude Paroz 865cd35c9b Made more extensive usage of context managers with open. 2012-05-05 14:06:36 +02:00
Aymeric Augustin e84f79f051 Fixed #18042 -- Advanced deprecation warnings.
Thanks Ramiro for the patch.
2012-05-03 15:27:01 +02:00
Aymeric Augustin ddfc7c2530 Fixed #4746 -- Allowed spaces around filter separator. 2012-04-30 21:01:06 +02:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Aymeric Augustin 3e8b40f479 Fixed #17992 -- Added a public API for localtime.
Thanks Bradley Ayers for the report.
2012-04-29 15:37:23 +02:00
Claude Paroz eb351ac9cb Fixed #18037 -- Changed behaviour of url and ssi template tags to the new syntax, as per official deprecation timeline. Thanks Ramiro Morales and Jannis Leidel for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-24 19:55:52 +00:00
Aymeric Augustin f0697570e9 Fixed #18103 -- Regression introduced in r17895.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-11 13:00:38 +00:00
Aymeric Augustin 93240b7d90 Fixed #17229 -- Allow 'True', 'False' and 'None' to resolve to the corresponding Python objects in templates.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17894 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-10 20:49:45 +00:00
Claude Paroz 8dd04fd84b Fixed #15683 -- Prevented escaped string to be needlessly marked safe twice in force_escape filter. Thanks tyrion for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-07 15:16:11 +00:00
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