#!/usr/bin/env python # -*- coding: utf-8 -*- import time from django import dispatch from django.core.signals import request_started from django.test.signals import template_rendered from django.conf import settings from django.db import connection from django.utils.encoding import force_unicode from django.utils.safestring import mark_safe USE_PYGMENTS = False try: import textwrap from pygments import highlight from pygments.formatters import HtmlFormatter from pygments.lexers import SqlLexer from pygments.styles import get_style_by_name USE_PYGMENTS = True except ImportError: pass if USE_PYGMENTS: WRAP = 120 STYLE = get_style_by_name('colorful') HEIGHT = '240px' # or '100%' if full height is wished TEMPLATE = """
""" # Monkeypatch instrumented test renderer from django.test.utils - we could use # django.test.utils.setup_test_environment for this but that would also set up # e-mail interception, which we don't want from django.test.utils import instrumented_test_render from django.template import Template, Context if Template.render != instrumented_test_render: Template.original_render = Template.render Template.render = instrumented_test_render # MONSTER monkey-patch old_template_init = Template.__init__ def new_template_init(self, template_string, origin=None, name='