# Path: templation/locals.py
# class LocalsManager(object):
#     def __init__(self):
#     def clear(self):
#     def thread(self):  # pragma: no cover
#     def user(self):
#     def user(self, value):
#     def resource(self):
#     def resource(self, value):
#     def token(self):
#     def token(self, value):
# 
# Path: templation/settings.py
# DEBUG = getattr(settings, 'TEMPLATION_DEBUG',
#                 not bool(getattr(settings, 'DEBUG', True)))
#     DAV_ROOT = settings.TEMPLATION_DAV_ROOT
#     DAV_STATIC_URL = settings.TEMPLATION_DAV_STATIC_URL
#     RESOURCE_MODEL = settings.TEMPLATION_RESOURCE_MODEL
# PROVIDER_NAME = getattr(settings, 'TEMPLATION_PROVIDER_NAME', 'templation')
# BOILERPLATE_FOLDER = getattr(settings, 'TEMPLATION_BOILERPLATE_FOLDER', None)
# BOILERPLATE_INITIALIZER = getattr(settings,
#                                   'TEMPLATION_BOILERPLATE_INITIALIZER',
#                                   'templation.models.copy_boilerplate_folder')
# DUMP_EXCEPTIONS = getattr(settings, 'TEMPLATION_DUMP_EXCEPTION', (
#     'TemplateDoesNotExist',
#     'TemplateSyntaxError',
# ))
# SECRET_KEY = getattr(settings, 'TEMPLATION_SECRET_KEY', settings.SECRET_KEY)
# SANDBOX = getattr(settings, 'TEMPLATION_SANDBOX', False)
# DEFAULT_WHITELIST_TAGS = [
#     'comment', 'csrf_token', 'cycle', 'filter', 'firstof', 'for', 'if',
#     'ifchanged', 'now', 'regroup', 'spaceless', 'templatetag', 'url',
#     'widthratio', 'with', 'extends', 'include', 'block'
# ]
# WHITELIST_TAGS = getattr(settings, 'TEMPLATION_WHITELIST_TAGS',
#                          DEFAULT_WHITELIST_TAGS)
# DEFAULT_WHITELIST_FILTERS = [
#     'add', 'addslashes', 'capfirst', 'center', 'cut', 'date', 'default',
#     'default_if_none', 'dictsort', 'dictsortreversed', 'divisibleby', 'escape',
#     'escapejs', 'filesizeformat', 'first', 'fix_ampersands', 'floatformat',
#     'force_escape', 'get_digit', 'iriencode', 'join', 'last', 'length',
#     'length_is', 'linebreaks', 'linebreaksbr', 'linenumbers', 'ljust', 'lower',
#     'make_list', 'phone2numeric', 'pluralize', 'pprint', 'random',
#     'removetags', 'rjust', 'safe', 'safeseq', 'slice', 'slugify',
#     'stringformat', 'striptags', 'time', 'timesince', 'timeuntil', 'title',
#     'truncatewords', 'truncatewords_html', 'unordered_list', 'upper',
#     'urlencode', 'urlize', 'urlizetrunc', 'wordcount', 'wordwrap', 'yesno'
# ]
# WHITELIST_FILTERS = getattr(settings, 'TEMPLATION_WHITELIST_FILTERS',
#                             DEFAULT_WHITELIST_FILTERS)
# DEFAULT_EXTRA_LIBRARIES = [
#     'templation.templatetags.templation_tags',
# ]
# EXTRA_LIBRARIES = getattr(settings, 'TEMPLATION_EXTRA_LIBRARIES',
#                           DEFAULT_EXTRA_LIBRARIES)
# def import_from_path(import_string):


from django.utils.functional import wraps
from django import template
from .locals import thread_locals
from .settings import get_resource_access_model, WHITELIST_TAGS, \
    WHITELIST_FILTERS, EXTRA_LIBRARIES
from importlib import import_module
# -*- coding: utf-8 -*-


def will_override():
    """
    Test the necessary conditions for a template to be overwritten

    :returns: (bool, resource_access)
    """
    _access = get_resource_access_model()
    try:
        resource_access = _access.objects.filter(

# Path: templation/locals.py
# class LocalsManager(object):
#     def __init__(self):
#     def clear(self):
#     def thread(self):  # pragma: no cover
#     def user(self):
#     def user(self, value):
#     def resource(self):
#     def resource(self, value):
#     def token(self):
#     def token(self, value):
# 
# Path: templation/settings.py
# DEBUG = getattr(settings, 'TEMPLATION_DEBUG',
#                 not bool(getattr(settings, 'DEBUG', True)))
#     DAV_ROOT = settings.TEMPLATION_DAV_ROOT
#     DAV_STATIC_URL = settings.TEMPLATION_DAV_STATIC_URL
#     RESOURCE_MODEL = settings.TEMPLATION_RESOURCE_MODEL
# PROVIDER_NAME = getattr(settings, 'TEMPLATION_PROVIDER_NAME', 'templation')
# BOILERPLATE_FOLDER = getattr(settings, 'TEMPLATION_BOILERPLATE_FOLDER', None)
# BOILERPLATE_INITIALIZER = getattr(settings,
#                                   'TEMPLATION_BOILERPLATE_INITIALIZER',
#                                   'templation.models.copy_boilerplate_folder')
# DUMP_EXCEPTIONS = getattr(settings, 'TEMPLATION_DUMP_EXCEPTION', (
#     'TemplateDoesNotExist',
#     'TemplateSyntaxError',
# ))
# SECRET_KEY = getattr(settings, 'TEMPLATION_SECRET_KEY', settings.SECRET_KEY)
# SANDBOX = getattr(settings, 'TEMPLATION_SANDBOX', False)
# DEFAULT_WHITELIST_TAGS = [
#     'comment', 'csrf_token', 'cycle', 'filter', 'firstof', 'for', 'if',
#     'ifchanged', 'now', 'regroup', 'spaceless', 'templatetag', 'url',
#     'widthratio', 'with', 'extends', 'include', 'block'
# ]
# WHITELIST_TAGS = getattr(settings, 'TEMPLATION_WHITELIST_TAGS',
#                          DEFAULT_WHITELIST_TAGS)
# DEFAULT_WHITELIST_FILTERS = [
#     'add', 'addslashes', 'capfirst', 'center', 'cut', 'date', 'default',
#     'default_if_none', 'dictsort', 'dictsortreversed', 'divisibleby', 'escape',
#     'escapejs', 'filesizeformat', 'first', 'fix_ampersands', 'floatformat',
#     'force_escape', 'get_digit', 'iriencode', 'join', 'last', 'length',
#     'length_is', 'linebreaks', 'linebreaksbr', 'linenumbers', 'ljust', 'lower',
#     'make_list', 'phone2numeric', 'pluralize', 'pprint', 'random',
#     'removetags', 'rjust', 'safe', 'safeseq', 'slice', 'slugify',
#     'stringformat', 'striptags', 'time', 'timesince', 'timeuntil', 'title',
#     'truncatewords', 'truncatewords_html', 'unordered_list', 'upper',
#     'urlencode', 'urlize', 'urlizetrunc', 'wordcount', 'wordwrap', 'yesno'
# ]
# WHITELIST_FILTERS = getattr(settings, 'TEMPLATION_WHITELIST_FILTERS',
#                             DEFAULT_WHITELIST_FILTERS)
# DEFAULT_EXTRA_LIBRARIES = [
#     'templation.templatetags.templation_tags',
# ]
# EXTRA_LIBRARIES = getattr(settings, 'TEMPLATION_EXTRA_LIBRARIES',
#                           DEFAULT_EXTRA_LIBRARIES)
# def import_from_path(import_string):


# Path: templation/utils.py
from django.utils.functional import wraps
from django import template
from .locals import thread_locals
from .settings import get_resource_access_model, WHITELIST_TAGS, \
    WHITELIST_FILTERS, EXTRA_LIBRARIES
from importlib import import_module

# -*- coding: utf-8 -*-


def will_override():
    """
    Test the necessary conditions for a template to be overwritten

    :returns: (bool, resource_access)
    """
    _access = get_resource_access_model()
    try:
        resource_access = _access.objects.filter(

            resource_pointer__resource=thread_locals.resource)[:1][0]