Commit Graph

172 Commits

Author SHA1 Message Date
Paweł Marczewski 7ee6043dba Fixed #24847 -- Prevented items set on a RequestContext from being lost.
Backport of 300e8baf94 from master
2015-05-27 10:08:31 -04:00
Simon Charette 3ab3be4b5d [1.8.x] Refs #24652 -- Converted a template test to avoid executing queries.
Backport of 8bf1449edb from master
2015-05-20 13:32:35 -04:00
Tim Graham 5c63c45512 [1.8.x] Fixed #23441, #24555 -- Improved the behavior of InclusionNode.
This change:

* Makes the InclusionNode cache-safe by removing render-time side effects
  to its nodelist.
* Ensures the render_context stack is properly scoped and reset by updating
  the render call to use Template.render rather than Nodelist.render.

Backport of 0808ccce38 from master
2015-04-01 13:12:18 -04:00
Tim Graham aba74d6f1e [1.8.x] Fixed escaping regression in urlize filter.
Now that the URL is always unescaped as of refs #22267,
we should re-escape it before inserting it into the anchor.

Backport of 7b1a67cce5 from master
2015-03-10 19:12:20 -04:00
Erik Romijn d16e4e1d6f [1.8.x] Fixed #24464 -- Made built-in HTML template filter functions escape their input by default.
This may cause some backwards compatibility issues, but may also
resolve security issues in third party projects that fail to heed warnings
in our documentation.

Thanks Markus Holtermann for help with tests and docs.

Backport of fa350e2f30 from master
2015-03-09 09:31:07 -04:00
Claude Paroz ac07890f95 [1.8.x] Fixed urlize regression with entities in query strings
Refs #22267.
Thanks Shai Berger for spotting the issue and Tim Graham for the
initial patch.
Backport of ec808e807 from master.
2015-03-06 22:22:51 +01:00
Preston Timmons 450b42eafe [1.8.x] Cleaned up template directory handling in template tests.
Backport of 8e129b42ad from master
2015-02-24 09:22:25 -05:00
Preston Timmons b22d20dd18 [1.8.x] Combined TemplateTests and TemplateRegressionTests.
Backport of 32c108a221 from master
2015-02-24 09:22:20 -05:00
Preston Timmons 2e7414cdf4 [1.8.x] Moved test_token_smart_split into ParserTests.
Backport of 25a0b5cdcd from master
2015-02-24 09:22:15 -05:00
Preston Timmons e15292daa0 [1.8.x] Moved ifchanged tests into syntax_tests/test_if_changed.py.
Backport of 3d8fee6051 from master
2015-02-24 09:22:05 -05:00
Preston Timmons f3a49c628e [1.8.x] Moved cache tests into syntax_tests/test_cache.py.
Backport of f6d087b628 from master
2015-02-24 09:21:54 -05:00
Preston Timmons d8114552a0 [1.8.x] Moved RequestContextTests into test_context.
Backport of 250a3d1993 from master
2015-02-24 09:18:28 -05:00
Preston Timmons c1bf9e47ec [1.8.x] Moved TemplateTagLoading cases into test_custom.
Backport of ff67ce5076 from master
2015-02-24 09:17:45 -05:00
Preston Timmons 272208c124 [1.8.x] Moved include tests into syntax_tests/test_include.py.
Backport of 06ffc764a9 from master
2015-02-24 09:10:01 -05:00
Preston Timmons cdb73ec8cd [1.8.x] Moved ssi tests into syntax_tests/test_ssi.py.
Backport of 441a47e1ef from master
2015-02-24 09:09:52 -05:00
Tim Graham 210bf24ddb [1.8.x] Cleaned up template loader tests.
Backport of 1827aa9024 from master
2015-02-24 08:59:05 -05:00
Aymeric Augustin cc4effba0b [1.8.x] Set context.template instead of context.engine while rendering.
This opens more possibilities, like accessing context.template.origin.

It also follows the chain of objects instead of following a shortcut.

Backport of 1bfcc95 from master
2015-02-19 22:10:56 +01:00
Tim Graham 2aa06e439a [1.8.x] Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters.
Backport of 307c0f299a from master
2015-02-17 19:05:31 -05:00
Aymeric Augustin e8950668ca [1.8.x] Deprecated TEMPLATE_DEBUG setting.
Backport of 15b711b from master.
2015-02-15 20:48:48 +01:00
Aymeric Augustin 0f3eb8260b [1.8.x] Fixed #24338 -- Accepted Template wrapper in {% extends %}.
Explicitly checking for django.template.Template subclasses is
preferrable to duck-typing because both the django.template.Template and
django.template.backends.django.Template have a render() method.

Thanks spectras for the report.

Backport of 47ee7b48 from master
2015-02-14 10:36:44 +01:00
Tim Graham a8b70d251d [1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d15563 from master
2015-02-09 14:24:06 -05:00
Aymeric Augustin 5fbec369aa [1.8.x] Fixed #24273 -- Allowed copying RequestContext more than once.
Thanks Collin Anderson for the report.

Backport of 31d3a355 from master
2015-02-05 14:07:18 +01:00
Aymeric Augustin f87457a460 [1.8.x] Fixed #24168 -- Allowed selecting a template engine in a few APIs.
Specifically in rendering shortcuts, template responses, and class-based
views that return template responses.

Also added a test for render_to_response(status=...) which was missing
from fdbfc980.

Thanks Tim and Carl for the review.

Backport of 2133f31 from master.

Conflicts:
	docs/topics/http/shortcuts.txt
	tests/generic_views/test_base.py
2015-02-03 08:32:14 +01:00
Tim Graham 663db8ea2a [1.8.x] Removed usage of deprecated removetags in a template test.
Backport of b84100e8e2 from master
2015-01-18 18:33:56 -05:00
Aymeric Augustin 79deb6a071 Accounted for multiple template engines in template responses. 2015-01-12 21:01:34 +01:00
Aymeric Augustin a3e783fe11 Deprecated passing a Context to a generic Template.render.
A deprecation path is required because the return type of
django.template.loader.get_template changed during the
multiple template engines refactor.

test_csrf_token_in_404 was incorrect: it tested the case when the
hardcoded template was rendered, and that template doesn't depend on the
CSRF token. This commit makes it test the case when a custom template is
rendered.
2015-01-12 21:01:34 +01:00
Tim Graham 9f51d0c86d Fixed test from refs #23913 when running tests in reverse. 2015-01-12 13:20:44 -05:00
Ola Sitarska d563e3be68 Fixed #23913 -- Deprecated the `=` comparison in `if` template tag. 2015-01-11 15:21:01 -05:00
Preston Timmons 665e0aa6ec Fixed #24094 -- Enabled template tests to run individually. 2015-01-09 11:43:59 -05:00
Preston Timmons de9ebdd39c Fixed #24022 -- Deprecated the ssi tag. 2015-01-05 19:35:02 -05:00
Claude Paroz 51890ce889 Applied ignore_warnings to Django tests 2014-12-30 18:16:25 +01:00
Aymeric Augustin 9eb4f28e89 Deprecated TEMPLATE_CONTEXT_PROCESSORS. 2014-12-28 17:02:31 +01:00
Aymeric Augustin d3205e3e2e Deprecated TEMPLATE_DIRS. 2014-12-28 17:02:30 +01:00
Aymeric Augustin cf0fd65ed4 Deprecated TEMPLATE_LOADERS. 2014-12-28 17:02:30 +01:00
Aymeric Augustin d3a982556d Deprecated TEMPLATE_STRING_IF_INVALID. 2014-12-28 17:02:30 +01:00
Aymeric Augustin 3dc01aaaaf Deprecated ALLOWED_INCLUDE_ROOTS. 2014-12-28 17:02:30 +01:00
Aymeric Augustin cf1f36bb6e Deprecated current_app in TemplateResponse and render(_to_response). 2014-12-28 17:02:29 +01:00
Aymeric Augustin 90805b240f Supported multiple template engines in render_to_string.
Adjusted its API through a deprecation path according to the DEP.
2014-12-28 16:23:02 +01:00
Aymeric Augustin 5523e4cdbb Removed private API find_template.
It wasn't documented and it wasn't used anywhere, except in a few tests
that don't test it specifically and can be rewritten with get_template.
2014-12-28 16:23:01 +01:00
Aymeric Augustin 4ea43ac915 Supported multiple template engines in get_template and select_template.
This commit changes the return type of these two functions. Instead of
returning a django.template.Template they return a backend-specific
Template class that must implement render(self, context).
2014-12-28 16:23:01 +01:00
Aymeric Augustin 92a2d049a2 Isolated template tests from Django settings. 2014-12-28 16:23:01 +01:00
Aymeric Augustin 7eefdbf7ab Cleaned up the django.template namespace.
Since this package is going to hold both the implementation of the Django
Template Language and the infrastructure for Multiple Template Engines,
it should be untied from the DTL as much as possible within our
backwards-compatibility policy.

Only public APIs (i.e. APIs mentioned in the documentation) were left.
2014-12-28 14:47:31 +01:00
Preston Timmons f91d7366e0 Fixed #16028 -- Moved defaultfilters tests into template_tests. 2014-12-16 14:45:19 -05:00
Aymeric Augustin 71a559e771 Removed obsolete code for running test_loaders.py.
Running this file as a standalone script doesn't work anyway.
2014-12-13 22:51:57 +01:00
Tim Graham 3bb52c5019 Refs #23890 -- Restored silencing of numpy DeprecationWarnings in template tests. 2014-12-06 11:27:15 -05:00
Preston Timmons 5c68870169 Fixed #23958 -- Rewrote filter tests as unit tests. 2014-12-06 10:57:46 -05:00
Ramiro Morales 16f26defa7 Converted recently refactored templates tests to SimpleTestCase.
These test methods don't need DB setup/teardown.

Refs #23768 and b872134b.
2014-12-03 18:56:46 -05:00
Berker Peksag 560b4207b1 Removed redundant numbered parameters from str.format().
Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".
2014-12-03 14:27:38 -05:00
Berker Peksag adacbd64a0 Fixed "no such test method" error in template_tests.
Without this patch, you couldn't run an individual test
case in template_tests.

Refs #23768
2014-12-03 13:04:23 +01:00
Preston Timmons b872134bfc Fixed #23768 -- Rewrote template tests as unit tests. 2014-12-02 19:18:35 -05:00