File: utils.py

package info (click to toggle)
python-django-tagging 1%3A0.5.0-5.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: python: 2,140; makefile: 166
file content (26 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Tests utils for tagging.
"""
from django.template import Origin
from django.template.loaders.base import Loader


class VoidLoader(Loader):
    """
    Template loader which is always returning
    an empty template.
    """
    is_usable = True
    _accepts_engine_in_init = True

    def get_template_sources(self, template_name):
        yield Origin(
            name='voidloader',
            template_name=template_name,
            loader=self)

    def get_contents(self, origin):
        return ''

    def load_template_source(self, template_name, template_dirs=None):
        return ('', 'voidloader:%s' % template_name)