raise TemplateDoesNotExist in DjangoParser when necessary
This commit is contained in:
@@ -6,7 +6,8 @@ from django.template import Template
|
|||||||
from django.template.loader_tags import (ExtendsNode, BlockNode,
|
from django.template.loader_tags import (ExtendsNode, BlockNode,
|
||||||
BLOCK_CONTEXT_KEY)
|
BLOCK_CONTEXT_KEY)
|
||||||
|
|
||||||
from compressor.exceptions import TemplateSyntaxError
|
|
||||||
|
from compressor.exceptions import TemplateSyntaxError, TemplateDoesNotExist
|
||||||
from compressor.templatetags.compress import CompressorNode
|
from compressor.templatetags.compress import CompressorNode
|
||||||
|
|
||||||
|
|
||||||
@@ -92,6 +93,8 @@ class DjangoParser(object):
|
|||||||
return Template(file.read().decode(self.charset))
|
return Template(file.read().decode(self.charset))
|
||||||
except template.TemplateSyntaxError as e:
|
except template.TemplateSyntaxError as e:
|
||||||
raise TemplateSyntaxError(str(e))
|
raise TemplateSyntaxError(str(e))
|
||||||
|
except template.TemplateDoesNotExist as e:
|
||||||
|
raise TemplateDoesNotExist(str(e))
|
||||||
|
|
||||||
def process_template(self, template, context):
|
def process_template(self, template, context):
|
||||||
template._render_firstnode = MethodType(patched_render_firstnode, template)
|
template._render_firstnode = MethodType(patched_render_firstnode, template)
|
||||||
|
|||||||
Reference in New Issue
Block a user