Commit Graph

8 Commits

Author SHA1 Message Date
Dave Smith b53b4d5c10 Fixed #25404 -- Added line numbers to TemplateSyntaxError strings.
This makes it much easier to diagnose a test failure when all
you have is the stack trace from an uncaught TemplateSyntaxError.
2015-09-15 12:25:13 -04:00
Doug Beck b7508896fb Fixed #24257 -- Corrected i18n handling of percent signs.
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 "%%".
2015-08-12 10:23:34 -04:00
Preston Timmons 55f12f8709 Cleaned up the template debug implementation.
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-03-20 08:58:07 -04:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Aymeric Augustin 92a2d049a2 Isolated template tests from Django settings. 2014-12-28 16:23:01 +01: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
Preston Timmons b872134bfc Fixed #23768 -- Rewrote template tests as unit tests. 2014-12-02 19:18:35 -05:00