Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/django/template/base.py
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #25423 -- Made error message for unknown template ↵Pindi Albert2015-10-051-2/+7
| | | | tag more helpful.
* Fixed #25466 -- Added backwards compatibility aliases ↵Tim Graham2015-09-301-0/+8
| | | | | | for LoaderOrigin and StringOrigin. Thanks Simon Charette for the DeprecationInstanceCheck class.
* Refs #22933 -- Removed template.resolve_variable() per ↵Tim Graham2015-09-241-15/+0
| | | | deprecation timeline.
* Refs #18773 -- Improved template variable exception ↵Nick Johnson2015-09-221-2/+7
| | | | logging message.
* Fixed #25404 -- Added line numbers to ↵Dave Smith2015-09-151-6/+16
| | | | | | | TemplateSyntaxError strings. This makes it much easier to diagnose a test failure when all you have is the stack trace from an uncaught TemplateSyntaxError.
* Fixed #24257 -- Corrected i18n handling of percent signs.Doug Beck2015-08-121-2/+5
| | | | | | | | | | | | | | | Refactored tests to use a sample project. Updated extraction: * Removed special handling of single percent signs. * When extracting messages from template text, doubled all percent signs so they are not interpreted by gettext as string format flags. All strings extracted by gettext, if containing a percent sign, will now be labeled "#, python-format". Updated translation: * Used "%%" for "%" in template text before calling gettext. * Updated {% trans %} rendering to restore "%" from "%%".
* Removed some u string prefixes in code comments.Tim Graham2015-07-061-7/+7
|
* Removed unused variable ↵Tim Graham2015-07-061-3/+0
| | | | | | template.base.ALLOWED_VARIABLE_CHARS. Unused since 5d863f1fbd26537a8bca2920bc591279d15fbdf1.
* Used %r in the TextNode repr to show newlines better.Ned Batchelder2015-06-301-2/+2
|
* Renamed RemovedInDjangoXYWarnings for new roadmap.Tim Graham2015-06-241-2/+2
| | | | | Forwardport of ae1d663b7913f6da233c55409c4973248372d302 from stable/1.8.x plus more.
* Fixed #24979 -- Removed usage of inspect.getargspec().Tim Graham2015-06-151-3/+5
|
* Fixed #17085, #24783 -- Refactored template library ↵Preston Timmons2015-05-211-396/+15
| | | | | | | | registration. * 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.
* Removed unnecessary arguments in .get method callsPiotr Jakimiak2015-05-131-2/+2
|
* Moved engine-related exceptions to ↵Preston Timmons2015-05-071-30/+2
| | | | | | | | django.template.exceptions. With the introduction of multiple template engines these exceptions are no longer DTL-specific. It makes more sense for them to be moved out of DTL-related modules.
* Fixed #24119, #24120 -- Formalized debug integration for ↵Preston Timmons2015-05-071-5/+19
| | | | template backends.
* Fixed #15053 -- Enabled recursive template loading.Preston Timmons2015-04-221-12/+26
|
* Removed cases of six.iter* wrapped in a list()Curtis Maloney2015-04-181-1/+1
| | | | | There's absolutely no advantage [and a mild performance hit] to using six.iter* in these cases.
* Fixed #23441, #24555 -- Improved the behavior of ↵Preston Timmons2015-04-011-3/+9
| | | | | | | | | | | 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.
* Fixed #18773 -- Added logging for template variable ↵Caroline Simpson2015-03-281-0/+7
| | | | | | | | resolving Added a django.template logger without a default handler. Added logging if there is an exception while resolving variables in a template.
* Cleaned up the template debug implementation.Preston Timmons2015-03-201-71/+237
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fed tuples to startswith when appropriateClaude Paroz2015-03-131-1/+1
|
* Fixed #24372 - Replaced TokenParser usage with ↵Preston Timmons2015-03-031-116/+0
| | | | traditional parsing.
* Removed a non-obvious side-effect of assigning ↵Aymeric Augustin2015-02-201-9/+5
| | | | | | Context.template. Explicit is better than implicit.
* Set context.template instead of context.engine while ↵Aymeric Augustin2015-02-191-12/+12
| | | | | | | | rendering. This opens more possibilities, like accessing context.template.origin. It also follows the chain of objects instead of following a shortcut.
* Sorted imports with isort; refs #23860.Tim Graham2015-02-061-16/+19
|
* Fixed #18651 -- Enabled optional assignments for ↵Preston Timmons2015-02-031-49/+30
| | | | simple_tag().
* Preserved context class in inclusion_tag.Aymeric Augustin2014-12-281-8/+2
| | | | | | | | | | Previously, when a template was rendered with RequestContext, inclusion tags were rendered with a plain context, losing additional information available in the RequestContext. The (admittedly bizarre) implementation of RequestContext.new() has the side-effect of not running template context processors, making this change backwards-compatible.
* Added a comment about the last use of Engine.get_default().Aymeric Augustin2014-12-281-0/+4
|
* Supported multiple template engines in get_template and ↵Aymeric Augustin2014-12-281-0/+2
| | | | | | | | 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).
* Removed some uses of global APIs from ↵Aymeric Augustin2014-12-281-3/+2
| | | | django.template.loader.
* Cleaned up the django.template namespace.Aymeric Augustin2014-12-281-0/+51
| | | | | | | | | 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.
* Fixed #23831 -- Supported strings escaped by third-party ↵Aymeric Augustin2014-12-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libs in Django. Refs #7261 -- Made strings escaped by Django usable in third-party libs. The changes in mark_safe and mark_for_escaping are straightforward. The more tricky part is to handle correctly objects that implement __html__. Historically escape() has escaped SafeData. Even if that doesn't seem a good behavior, changing it would create security concerns. Therefore support for __html__() was only added to conditional_escape() where this concern doesn't exist. Then using conditional_escape() instead of escape() in the Django template engine makes it understand data escaped by other libraries. Template filter |escape accounts for __html__() when it's available. |force_escape forces the use of Django's HTML escaping implementation. Here's why the change in render_value_in_context() is safe. Before Django 1.7 conditional_escape() was implemented as follows: if isinstance(text, SafeData): return text else: return escape(text) render_value_in_context() never called escape() on SafeData. Therefore replacing escape() with conditional_escape() doesn't change the autoescaping logic as it was originally intended. This change should be backported to Django 1.7 because it corrects a feature added in Django 1.7. Thanks mitsuhiko for the report.
* Fixed #23968 -- Replaced list comprehension with ↵Jon Dufresne2014-12-081-3/+3
| | | | generators and dict comprehension
* Encapsulated TEMPLATE_DEBUG in Engine.Aymeric Augustin2014-11-231-3/+2
|
* Encapsulated TEMPLATE_STRING_IF_INVALID in Engine.Aymeric Augustin2014-11-231-15/+10
|
* Move compile_string into the Engine class.Aymeric Augustin2014-11-231-13/+1
|
* Added to each Context a reference to the Engine.Aymeric Augustin2014-11-231-0/+9
| | | | It's only available during the rendering.
* Introduced a template engine class.Aymeric Augustin2014-11-231-1/+5
| | | | Moved Django templates loading infrastructure there.
* Simplified caching of templatetags modules.Aymeric Augustin2014-11-191-19/+15
|
* Fixed #23489 -- Added numpy 1.9+ support in template lookupsTim Graham2014-09-301-1/+3
|
* Limited lines to 119 characters in django/Tim Graham2014-09-051-1/+2
| | | | refs #23395.
* Fixed #16383 -- Raised the AttributeError raised in ↵Anubhav Joshi2014-07-311-1/+4
| | | | | | property of an object when used in a template. Thanks maraujop for the report and Hiroki and Tim Graham for review.
* Fixed #22933 -- Deprecated ↵Tim Graham2014-07-011-0/+5
| | | | django.template.resolve_variable().
* Fixed many typos in comments and docstrings.Rodolfo Carvalho2014-03-031-1/+1
| | | | Thanks Piotr Kasprzyk for help with the patch.
* Removed incorrect statement from docstringPatrick Robertson2014-02-231-3/+0
| | | | | | | | | | The docstring of FilterExpression said that it shouldn't be instantiated from anywhere but the get_filters_from_token helper function. However, that helper function was deleted in commit 3ede006fc98f7e96ae9fb997872f78635576d5f8 and FilterExpression is instantiated from inside the compile_filter help function.
* Moved the loader tags registration with the other builtins.Baptiste Mispelon2014-01-191-0/+1
|
* Renamed AppCache to Apps.Aymeric Augustin2013-12-241-2/+2
| | | | | | Also renamed app_cache to apps and "app cache" to "app registry". Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
* Moved apps back in the toplevel django namespace.Aymeric Augustin2013-12-221-1/+1
| | | | Reverted 4a56a93cc458e9ab4dcab95d9f5067d4975dd1a2.
* Stopped iterating on INSTALLED_APPS.Aymeric Augustin2013-12-221-2/+6
| | | | Used the app cache's get_app_configs() method instead.
* Fixed E127 pep8 warnings.Loic Bistuer2013-12-141-4/+2
|