Source

django-flext / django_flext / __init__.py

Full commit
import threading

_settings = threading.local()

def add_dirs(self, template_dirs, loader=None):
    """
    Add a list of template directories to use.
    
    The file system template loader will be used unless an alternate loader is
    provided.
    
    """
    if loader:
        value = (loader, template_dirs)
    else:
        value = template_dirs
        
    try:
        _settings.dirs.append(value)
    except:
        _settings.dirs = []
        _settings.dirs.append(value)

def reset():
    """
    Reset the flexible template loader so no template directories are used.
    
    """
    _settings.dirs = []

def get_dirs():
    """
    Return the current lists of template directories which the loader should
    use.

    """
    return list(getattr(_settings, 'dirs', []))