summaryrefslogtreecommitdiff
path: root/tests/template_tests/tests.py
AgeCommit message (Collapse)Author
2023-10-02Fixed #34883 -- Allowed template tags to set extra data on templates.Carlton Gibson
By setting a value in the `parser.extra_data` mapping, template tags pass additional data out of the parsing context. Any extra data set is exposed on the template via the matching `.extra_data` attribute. Library authors should use a key to namespace extra data. The 'django' namespace is reserved for internal use.
2023-03-20Fixed some typos in comments, docstrings, and tests.Liyang Zhang
2022-05-20Fixed #33653 -- Fixed template crash when calling methods for built-in types ↵cheng
without required arguments. Regression in 09341856ed9008875c1cc883dc0c287670131458.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-01Fixed CVE-2022-22818 -- Fixed possible XSS via {% debug %} template tag.Markus Holtermann
Thanks Keryn Knight for the report. Co-authored-by: Adam Johnson <me@adamj.eu>
2021-08-09Refs #33002 -- Made template_tests.tests.py's tests test both Lexer and ↵Chris Jerdonek
DebugLexer.
2021-07-02Fixed #28935 -- Fixed display of errors in extended blocks.cammil
Get the template that caused the exception and get the exception info from that template, using the node that caused the exception.
2017-03-25Fixed #27956 -- Fixed display of errors in an {% extends %} child.Tim Graham
Thanks Ling-Xiao Yang for the report and test, and Preston Timmons for the fix.
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-12-20Fixed #27584 -- Fixed display of render time template errors.Preston Timmons
2016-06-16Fixed #26747 -- Used more specific assertions in the Django test suite.Jon Dufresne
2016-04-09Fixed #26403 -- Removed translated content in "Invalid block tag" message.amureki
2016-04-08Fixed E128 flake8 warnings in tests/.Tim Graham
2016-01-26Fixed #25848 -- Set template origin on each node.Preston Timmons
Prior to 55f12f8709, the template origin was available on each node via `self.token.source[0]`. This behavior was removed when debug handling was simplified, but 3rd-party debugging tools still depend on its presence. This updates the Parser to set origin on individual nodes. This enables the source template to be determined even when template extending or including is used.
2015-12-31Fixed #26013 -- Moved django.core.urlresolvers to django.urls.Marten Kenbeek
Thanks to Tim Graham for the review.
2015-10-05Fixed #25423 -- Made error message for unknown template tag more helpful.Pindi Albert
2015-09-15Fixed #25404 -- Added line numbers to TemplateSyntaxError strings.Dave Smith
This makes it much easier to diagnose a test failure when all you have is the stack trace from an uncaught TemplateSyntaxError.
2015-05-21Fixed #17085, #24783 -- Refactored template library registration.Preston Timmons
* Converted the ``libraries`` and ``builtins`` globals of ``django.template.base`` into properties of the Engine class. * Added a public API for explicit registration of libraries and builtins.
2015-05-20Refs #24652 -- Converted a template test to avoid executing queries.Simon Charette
2015-04-22Fixed #15053 -- Enabled recursive template loading.Preston Timmons
2015-04-20Updated template tests to create their own engine.Preston Timmons
This continues work to treat Django templates as a library.
2015-03-20Cleaned up the template debug implementation.Preston Timmons
This patch does three major things: * Merges the django.template.debug implementation into django.template.base. * Simplifies the debug implementation. The old implementation copied debug information to every token and node. The django_template_source attribute was set in multiple places, some quite hacky, like django.template.defaulttags.ForNode. Debug information is now annotated in two high-level places: * Template.compile_nodelist for errors during parsing * Node.render_annotated for errors during rendering These were chosen because they have access to the template and context as well as to all exceptions that happen during either the parse or render phase. * Moves the contextual line traceback information creation from django.views.debug into django.template.base.Template. The debug views now only deal with the presentation of the debug information.
2015-02-24Cleaned up template directory handling in template tests.Preston Timmons
2015-02-24Combined TemplateTests and TemplateRegressionTests.Preston Timmons
2015-02-24Moved test_token_smart_split into ParserTests.Preston Timmons
2015-02-24Moved ifchanged tests into syntax_tests/test_if_changed.py.Preston Timmons
2015-02-24Moved cache tests into syntax_tests/test_cache.py.Preston Timmons
2015-02-24Moved RequestContextTests into test_context.Preston Timmons
2015-02-24Moved TemplateTagLoading cases into test_custom.Preston Timmons
2015-02-24Moved include tests into syntax_tests/test_include.py.Preston Timmons
2015-02-24Moved ssi tests into syntax_tests/test_ssi.py.Preston Timmons
2015-02-24Cleaned up template loader tests.Preston Timmons
2015-02-19Set context.template instead of context.engine while rendering.Aymeric Augustin
This opens more possibilities, like accessing context.template.origin. It also follows the chain of objects instead of following a shortcut.
2015-02-15Deprecated TEMPLATE_DEBUG setting.Aymeric Augustin
2015-02-14Fixed #24338 -- Accepted Template wrapper in {% extends %}.Aymeric Augustin
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.
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-12Deprecated passing a Context to a generic Template.render.Aymeric Augustin
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-05Fixed #24022 -- Deprecated the ssi tag.Preston Timmons
2014-12-28Deprecated TEMPLATE_CONTEXT_PROCESSORS.Aymeric Augustin
2014-12-28Deprecated TEMPLATE_DIRS.Aymeric Augustin
2014-12-28Deprecated TEMPLATE_LOADERS.Aymeric Augustin
2014-12-28Deprecated TEMPLATE_STRING_IF_INVALID.Aymeric Augustin
2014-12-28Deprecated ALLOWED_INCLUDE_ROOTS.Aymeric Augustin
2014-12-28Supported multiple template engines in get_template and select_template.Aymeric Augustin
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-28Cleaned up the django.template namespace.Aymeric Augustin
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-06Fixed #23958 -- Rewrote filter tests as unit tests.Preston Timmons
2014-12-03Converted recently refactored templates tests to SimpleTestCase.Ramiro Morales
These test methods don't need DB setup/teardown. Refs #23768 and b872134b.
2014-12-03Removed redundant numbered parameters from str.format().Berker Peksag
Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".
2014-12-02Fixed #23768 -- Rewrote template tests as unit tests.Preston Timmons
2014-11-25Fixed #23914 -- Improved {% now %} to allow storing its result in the context.Baptiste Mispelon
Thanks to Tim for the review.