Commit Graph

291 Commits

Author SHA1 Message Date
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
Luke Plant a482cc0ba3 Fixed #16004 - csrf_protect does not send cookie if view returns TemplateResponse
The root bug was in decorator_from_middleware, and the fix also corrects
bugs with gzip_page and other decorators.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16276 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-24 21:28:43 +00:00
Jannis Leidel 0322f2b653 Fixed #15263 -- Added support for format localization to the now template tag. Thanks to danielr and dmclain.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-07 16:58:45 +00:00
Jannis Leidel 950e05c3ff Fixed #14262 -- Added new assignment_tag as a simple way to assign the result of a template tag to a context variable. Thanks, Julien Phalip.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16149 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-03 11:52:42 +00:00
Jannis Leidel 0b1a061881 Replaced old-style with new-style decorator syntax.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-01 16:46:02 +00:00
Jannis Leidel 2ac4f175ec Fixed #15070 -- Also pass current_app and use_l10n in inclusion_tags. Thanks, raony, mk and goodtune.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-28 13:41:28 +00:00
Luke Plant 1286d78311 Fixed #15791 - method to signal that callable objects should not be called in templates
Thanks to ejucovy for the suggestion and patch!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-19 22:06:19 +00:00
Chris Beaven 9587235530 Fixes #15721 (again) via a minor tweak to avoid unexpected behaviour of copy() which caused a range of test failures
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-19 02:14:07 +00:00
Chris Beaven d59baa07f0 Fixes #15721 -- Make {% include %} and RequestContext work together again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-17 04:52:31 +00:00
Russell Keith-Magee 4d94c0cb38 Advanced deprecations in django.template.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15985 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-02 08:41:03 +00:00
Adrian Holovaty 13864703bc Removed a bunch more Python 2.4 workarounds now that we don't support that version. Refs #15702 -- thanks to jonash for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28 02:11:19 +00:00
Luke Plant e2627d267d Removed an unused code path.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15796 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-10 18:42:33 +00:00
Luke Plant e9d2763947 Fixed #15572 - include with "only" option discards context properties (such as autoescape)
Thanks to dfoerster for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-10 18:42:24 +00:00
Russell Keith-Magee c260c533e1 Fixed #15570 -- Corrected a flaw in the design of the silent flag on {% cycle %}. Thanks to Brian Neal for the report, and to Andrew and Jannis for the design consult.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-08 13:43:53 +00:00
Ramiro Morales 3ecf628b36 Fixed #11206 -- Ensure that the floatformat template filter doesn't switch to scientific notation when asked to format a zero value with more than six decimal places. Thanks Tai Lee for the report and fix and Facundo Batista for his help when Decimal module expertise was needed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15736 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03 20:56:46 +00:00
Russell Keith-Magee edfed18581 Fixed #15502 -- Ensure that nested TemplateDoesNotExist errors are propegated with a meaningful error message when loaded using select_template. Thanks to jaylett for the report, and GDorn for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03 00:41:40 +00:00
Russell Keith-Magee 17bd34930a Fixed #15530 -- Corrected typo in template loader deprecation message. Thanks to msaelices for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03 00:25:17 +00:00
Luke Plant 2366415f48 Fixed #15368 - test failures due to regression with RequestContext
Thanks to cyberdelia for the reports on this.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-27 00:24:35 +00:00
Chris Beaven 4419f5fc00 Fix broken tests due to changes in r15591 by updating the test store_rendered_templates signal handler.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-21 10:12:23 +00:00
Chris Beaven 1073a83f2c Ensure render_to_string leaves the context instance stack in the state it was originally passed in.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15591 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-20 04:55:11 +00:00
Russell Keith-Magee d8c38bd2c9 Fixed #14046 -- Made {% include %} behave the same, regardless of whether the template included is named by variable or constant string. Thanks to defcube for the report, and George Karpenkov for the draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15413 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-04 17:10:21 +00:00
Ramiro Morales 193f14d862 Fixed #15157 -- Modified evaluation of literals surrounded by _(' and ')' in templates to be evaluated at render time instead of at compile time by using ugettext_lazy. Thanks Jonathan S for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15327 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 15:12:18 +00:00
Alex Gaynor 561af6417e Fixed #13828 -- DRY'd up the dictsort(reversed) filters, will speed them up as well.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 03:34:16 +00:00
Russell Keith-Magee 3f528e10d5 Fixed #15012 -- Added post-rendering callbacks to TemplateResponse so that decorators (in particular, the cache decorator) can defer processing until after rendering has occurred. Thanks to Joshua Ginsberg for the draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-24 14:24:35 +00:00
Russell Keith-Magee 3a6491cf56 Fixed #14240 -- Enabled localization for the filesize filter. Thanks to David Danier for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15290 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-24 08:16:09 +00:00
Jannis Leidel a3894945b6 Fixed #15010 -- Added current_app parameter to close gap between TemplateResponse and render method. Thanks, acdha.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15153 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-05 22:41:43 +00:00
Ramiro Morales 0f783b7f4e Fixed #2986 -- Made the JavaScript code that drives related model instance addition in a popup window handle a model representation containing new lines. Also, moved the escapejs functionality yoo django.utils.html so it can be used from Python code. Thanks andrewwatts for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-02 17:34:52 +00:00
Chris Beaven df6ad35c56 Fixed #7153 -- _resolve_lookup now does a better job of resolving callables and correctly catches all silent_variable_exceptions
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-19 23:47:24 +00:00
Russell Keith-Magee 314fabc930 Fixed #14908 -- Added a 'takes_context' argument to simple_tag. Thanks to Julien Phalip for driving the issue and providing the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-19 15:00:50 +00:00
Chris Beaven 3ae9117c46 Fixes #7817 and #9456.
- The include tag now has a 'with' option to include to provide extra context
  vairables to the included template.

- The include tag now has an 'only' option to exclude the current context
  when rendering the included template.

- The with tag now accepts multiple variable assignments.

- The with, include and blocktrans tags now use a new keyword argument format
  for variable assignments (e.g. `{% with foo=1 bar=2 %}`).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-18 02:50:26 +00:00
Ramiro Morales 87315cc22d Fixed #2411 -- Fixed some XHTML validation errors in admindocs pages. Thanks to James Wheare for the report and to Simon Greenhill for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14920 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-16 12:11:20 +00:00
Russell Keith-Magee e0dcd7666a Fixed #12815 -- Added TemplateResponse, a lazy-evaluated Response class. Thanks to Simon Willison for the original idea, and to Mikhail Korobov and Ivan Sagalaev for their assistance, including the draft patch from Mikhail.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-07 13:57:01 +00:00
Ramiro Morales 23f69af454 Fixed #12201 -- Added a lineno attibute to template Token so e.g. we can report line numbers in errors during i18n literals extraction. Thanks madewulf for the report and Claude Paroz for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14813 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-04 17:42:54 +00:00
Russell Keith-Magee 0be14b0b96 Fixed #12248 -- Refactored django.template to get code out of __init__.py, to help with avoiding circular import dependencies. Thanks to Tom Tobin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-27 05:47:30 +00:00
Chris Beaven 4c51986790 Fixes #3529 -- more explicit documentation about Context.update. Thanks for the patch, ggetzie.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-24 00:36:36 +00:00
Chris Beaven f6ead36969 Fixed #4552 -- minor tidy up of the {% for %} tag's comma splitting
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14656 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-21 08:03:58 +00:00
Russell Keith-Magee 7ff5580d95 Fixed #14389, #9666 -- Started the migration path to make the first argument to url and ssi template tags syntactically consistent with other tags. Thanks to Sean Brant for the draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-20 06:22:28 +00:00
Jannis Leidel 17b329ae08 Fixed #10004 and #12320 -- Enabled the makemessages management command to collect comments for translators that start with the "Translators" keyword. Thanks for the report and patches, martinb and Claude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14595 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17 15:37:33 +00:00
Russell Keith-Magee a89e02637b Fixed #13567 -- Added a 'silent' argument to the cycle tag, so that you can declare a cycle without producing a value in the template. Thanks to anentropic for the suggestion and initial patch, and Łukasz Rekucki for the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-02 13:42:30 +00:00
Russell Keith-Magee 20e09ca817 Fixed #14589 -- Corrected a copy-and-paste error introduced in r14395. Thanks to Adam McKerlie for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14397 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-30 04:28:43 +00:00
Russell Keith-Magee ccc49029b8 Fixed #14181 -- Added a template tag and filters to allow localization to be disabled in a template. Thanks to Benjamin Wohlwend for the work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 16:48:58 +00:00
Russell Keith-Magee 1070c57b83 Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to DeprecationWarnings, and removed 1.1 deprecated code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:20:07 +00:00
Luke Plant 6fb4f6e299 Fixed #13765 - 'safe' parameter for urlencode filter
Thanks to KyleMac for the suggestion and SmileyChris for the patch

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13849 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-13 23:01:34 +00:00
Luke Plant 3f9054dd77 Fixed #12965 - unordered_list template filter fails when given a non-iterable second item in a two item list
Thanks to grahamu for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-13 22:31:17 +00:00
Luke Plant 364583b894 Fixed #14235 - UnicodeDecodeError in CSRF middleware
Thanks to jbg for the report.

This changeset essentially backs out [13698] in favour of a method that
sanitizes the token rather than escaping it.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@13732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-10 22:56:56 +00:00
James Bennett 9e3b327aca Patch CSRF-protection system to deal with reported security issue. Announcement and details to follow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13698 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-09 00:34:54 +00:00
Luke Plant 0b37d56481 Fixed #13475 - for tag raises an exception when trying to unpack a non-iterable item
Thanks to SmileyChris for the report and patch.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@13690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-07 20:30:46 +00:00
Russell Keith-Magee 842ceb5fe6 Fixed #14002 -- Modified filesize filter to ensure strings are translatable. Thanks to claudep for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-16 04:42:44 +00:00
Russell Keith-Magee 047d161164 Fixed #14002 -- Updated filesize filter to support terabyte and petabyte file sizes. Thanks to Aaron T. Myers for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13584 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-14 12:45:15 +00:00