Commit Graph

230 Commits

Author SHA1 Message Date
Karen Tracey ed36a5f2ce Fixed #12554 again: Corrected regression in silencing attribute lookups introduced in r12823, plus added a test for this so it doesn't regress again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12834 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-22 19:08:04 +00:00
Karen Tracey 2403f581b3 Fixed #12554: Silence exceptions that have specified silent_variable_failure=True. Thanks Thomas Steinacher, copelco, mlavin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20 20:27:57 +00:00
Russell Keith-Magee 003fe52225 Fixed #13123 -- Cleaned up template loader for PyPy compatibility. Thanks to avostryakov for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12805 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-18 15:35:15 +00:00
Karen Tracey 80e744945c Fixed #12787: Correctly identify the template that does not exist when a template being extended includes another template that does not exist. Thanks to trigeek38 for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12792 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-16 14:34:57 +00:00
Russell Keith-Magee beca4b8109 Fixed #13114 -- Modified escapejs to produce output that is JSON compliant. Thanks to David Danier for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12780 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-15 07:22:20 +00:00
Luke Plant 960af90279 Fixed #13058 - "smart if" template tag doesn't support "if not in ..." condition
Thanks to ramusus for the report.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-08 23:25:37 +00:00
Karen Tracey 50e46c017e Fixed #11461: Ensured complete traceback is available on the debug page when an exception is encountered during template rendering, even when running on Python 2.6 or higher. Thanks Glenn.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12725 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-08 17:01:21 +00:00
Russell Keith-Magee f034c79cbc Fixed #6510 -- Refactored the way child nodes are found in template nodes to avoid potential inconsistencies. Thanks to SmileyChris for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-02 07:42:51 +00:00
Karen Tracey 698410ab6f Fixed #12992: Adjusted the new template loader code so that the template
file name is correctly reported on the debug page when a template syntax
error is raised.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@12643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-01 23:05:35 +00:00
Karen Tracey 9fab1467c7 Removed more stray tabs in Python files.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12616 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-27 16:30:27 +00:00
Russell Keith-Magee 41c30f2fb8 Fixed #12981 -- Removed some stray tabs. Thanks to loewis for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-27 05:38:17 +00:00
Joseph Kocherhans fd233f40d1 Fixed #12070. Fixed a case where var._whatever wasn't raising a TemplateSyntaxError.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 18:50:57 +00:00
Justin Bronn 349827996b Fixed #12072 -- Certain characters no longer break url tag. Thanks, Alexander Dutton.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 05:17:39 +00:00
Jacob Kaplan-Moss 49d6a82261 Fixed #11687: the `add` filter is now less failsome when faced with things that can't be coerced to integers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-22 23:34:33 +00:00
Jannis Leidel 84f8213d74 Fixed #5972 - Allow the template filters to be used with the trans tag. Thanks for the initial patch, Dmitri Fedortchenko.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12472 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-21 23:43:28 +00:00
Jannis Leidel b459f5b7e3 Fixed #5971 - Fixed inconsistent behaviour of the TokenParser when parsing filters that follow constant strings or variables. Thanks Dmitri Fedortchenko, Adam Vandenberg and Ramiro Morales.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12471 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-21 23:42:57 +00:00
Jannis Leidel 6cafd4b21f Fixed #7876 - Improved template error message to include expected end tag. Thanks to Matthias Kestenholz for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12460 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-21 23:38:33 +00:00
Russell Keith-Magee e6740cb39c Fixed #11944 -- Improved exception handling for the filesizeformat filter. Thanks to rfk for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-13 14:37:17 +00:00
Russell Keith-Magee 12d3799dd2 Fixed #6587 -- Removed nasty __path__ hacking in templatetag loading. Thanks to Øyvind Satvik and Andrew Badr for their work on this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-26 01:38:50 +00:00
Adrian Holovaty 5ceed0a053 Changed a whole bunch of places to raise exception instances instead of old-style raising exception classes plus a comma. Good for the future Python 3 conversion
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:36:20 +00:00
Jannis Leidel 20fbba7f90 Fixed #12472 - Correctly show TimeFields values when using locale-aware formatting. Thanks to Ramiro Morales for providing the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12050 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-01 21:36:36 +00:00
Jannis Leidel 9233d04265 Fixed #7980 - Improved i18n framework to support locale aware formatting (dates and numbers) and form processing.
Thanks to Marc Garcia for working on this during his Google Summer of Code 2009!

Additionally fixes #1061, #2203, #3940, #5526, #6449, #6231, #6693, #6783, #9366 and #10891.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 17:58:49 +00:00
Simon Willison c804179126 Fixed a broken ImproperlyConfigured error message
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11923 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-20 22:46:35 +00:00
Russell Keith-Magee 44b9076bbe Fixed #6262 -- Added a cached template loader, and modified existing template loaders and tag to be cacheable. Thanks to Mike Malone for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-14 12:08:23 +00:00
Karen Tracey f761802b22 Fixed #11972: Corrected title filter handling of numbers followed by letters. Thanks schwank@gmail.com and Randy Barlow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-12 17:20:32 +00:00
Luke Plant 2c2f5aee4d Implemented 'smart if' template tag, allowing filters and various operators to be used in the 'if' tag
Thanks to Chris Beaven for the initial patch, Fredrik Lundh for the basis
of the parser methodology and Russell Keith-Magee for code reviews.

There are some BACKWARDS INCOMPATIBILITIES in rare cases - in particular, if
you were using the keywords 'and', 'or' or 'not' as variable names within
the 'if' expression, which was previously allowed in some cases.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11806 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-09 22:40:36 +00:00
Luke Plant 43c2ed0eb3 Fixed #12095 - login and other contrib views failing if template rendered using inclusion tag.
The {% csrf_token %} tag is unable to get its value if a template is
rendered using an inclusion_tag, since that creates a brand new Context,
rather than using the existing one.  Since this is a common pattern, and we
need CSRF protection to be as simple and easy as possible, we special case
the csrf_token and copy it from the parent context to the new context.

A more elegant and general solution may appear in future, but this is good
enough for now.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11672 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-27 21:27:09 +00:00
Luke Plant 7230a995ce Moved contrib.csrf.* to core code.
There is stub code for backwards compatiblity with Django 1.1 imports.

The documentation has been updated, but has been left in
docs/contrib/csrf.txt for now, in order to avoid dead links to
documentation on the website.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-27 00:36:34 +00:00
Luke Plant 8e70cef9b6 Fixed #9977 - CsrfMiddleware gets template tag added, session dependency removed, and turned on by default.
This is a large change to CSRF protection for Django.  It includes:

 * removing the dependency on the session framework.
 * deprecating CsrfResponseMiddleware, and replacing with a core template tag.
 * turning on CSRF protection by default by adding CsrfViewMiddleware to
   the default value of MIDDLEWARE_CLASSES.
 * protecting all contrib apps (whatever is in settings.py)
   using a decorator.

For existing users of the CSRF functionality, it should be a seamless update,
but please note that it includes DEPRECATION of features in Django 1.1,
and there are upgrade steps which are detailed in the docs.

Many thanks to 'Glenn' and 'bthomas', who did a lot of the thinking and work
on the patch, and to lots of other people including Simon Willison and
Russell Keith-Magee who refined the ideas.

Details of the rationale for these changes is found here:

http://code.djangoproject.com/wiki/CsrfProtection

As of this commit, the CSRF code is mainly in 'contrib'.  The code will be
moved to core in a separate commit, to make the changeset as readable as
possible.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-26 23:23:07 +00:00
Jacob Kaplan-Moss b30cba4e2b Fixed #11993: fixed the the `floatformat` filter on `NaN` values in Python 2.6.3. Thanks, kklimonda.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11619 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-12 16:53:23 +00:00
Russell Keith-Magee 8d48eaa064 Fixed #10061 -- Added namespacing for named URLs - most importantly, for the admin site, where the absence of this facility was causing problems. Thanks to the many people who contributed to and helped review this patch.
This change is backwards incompatible for anyone that is using the named URLs
introduced in [9739]. Any usage of the old admin_XXX names need to be modified
to use the new namespaced format; in many cases this will be as simple as a
search & replace for "admin_" -> "admin:". See the docs for more details on
the new URL names, and the namespace resolution strategy.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-16 16:16:13 +00:00
Russell Keith-Magee 6ed0345092 Fixed #11413 -- Added notes on the cycle and firstof tag detailing that variables output by those tags will not be escaped by default. Thanks to krystal for the report and draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-03 05:41:36 +00:00
Karen Tracey 50745cc31e Fixed #11066 -- Corrected 15 duplicate "the"s found in docs and code comments. Thanks kaikuehne.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10801 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-17 16:45:28 +00:00
Jacob Kaplan-Moss 9e7388f885 Fixed #11026, a small typo in the regroup template tag docstring. Thanks,
mitsuhiko.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10687 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-07 13:46:16 +00:00
Malcolm Tredinnick 8931d8d688 Fixed #10675 -- Added unicode paragraph and line-sep handling to escapejs.
There were a couple of line breaking Unicode characters (\u2028 and
\u2029) that cause Javascript errors, at least in Firefox, if not
escaped. So now we do so. Based on a patch from rleland.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 04:55:41 +00:00
Malcolm Tredinnick b1a5db37e6 Fixed #10369 -- Fixed auto-escaping inside "tran" and "blocktrans" tags.
Patch from Andrew Badr.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 12:03:52 +00:00
Malcolm Tredinnick be4a83c448 Fixed #9315 -- Handle spaces in URL tag arguments.
Thanks Natalia Bidart and Matías Bordese for most of this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 04:13:27 +00:00
Jacob Kaplan-Moss 6d6bbb6d05 Fixed #9756: the for tag no longer leaves the context stack unbalanced when dealing with an empty iterable. Thanks, seanl.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-07 22:02:34 +00:00
Jacob Kaplan-Moss 4f7950ac05 Fixed #10644: removed an undocumented, unused, and (as far as I can tell) unnecessary "feature" of the ifchanged tag. Thanks, akaihola.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-07 21:55:39 +00:00
Jacob Kaplan-Moss 9828557731 Fixed #9520: make the date filter fail silently for non-date values. Thanks, Andrew Badr and Eric Holscher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10365 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 05:20:25 +00:00
Jacob Kaplan-Moss 73c0556911 Fixed #10053: the most exciting commit you'll ever see.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10358 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 01:55:49 +00:00
Brian Rosner 64e82fb648 Fixed #10043 -- widthratio tag now accepts a variable for the max_width argument.
The max_width argument now passes through FilterExpression which by side-affect
allows float values, but will be truncated.

Thanks obeattie and Eric Holscher for patches.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 23:41:36 +00:00
Jacob Kaplan-Moss 624caace17 Fixed #9005: don't wig out when reversing a URL if SETTINGS_MODULE isn't set. While I was there, I fixed #10599 by re-raising the original error message, which is almost always a better idea. Thanks, Eric
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10350 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 22:46:46 +00:00
Jacob Kaplan-Moss a68c4a85ce Fixed #10513: floatformat now works with floatish things, not just real floats. Thanks, Alex.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10278 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 18:17:21 +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 9ac3905f01 Fixed #10079 -- Moved settings import inside the function that uses it so that the module can be imported without needing settings, thanks kcarnold and mcroydon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10209 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 20:15:01 +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
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
Jacob Kaplan-Moss 9797d51efe Fixed an error in the `firstof` template tag when used with `TEMPLATE_STRING_IF_INVALID`. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10124 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 22:00:13 +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