Ticket #13049: extends_template.diff

File extends_template.diff, 1.8 KB (added by Jared Forsyth, 15 years ago)
  • django/template/loader_tags.py

     
    9999            return parent # parent is a Template object
    100100        try:
    101101            return get_template(parent)
    102         except TemplateDoesNotExist:
    103             raise TemplateSyntaxError("Template %r cannot be extended, because it doesn't exist" % parent)
     102        except TemplateDoesNotExist, e:
     103            if e.message == parent:
     104                raise TemplateSyntaxError("Template %r cannot be extended, because it doesn't exist" % parent)
     105            else:
     106                raise
    104107
    105108    def render(self, context):
    106109        compiled_parent = self.get_parent(context)
  • django/template/debug.py

     
    1 from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError
     1from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError, TemplateDoesNotExist
    22from django.utils.encoding import force_unicode
    33from django.utils.html import escape
    44from django.utils.safestring import SafeData, EscapeData
     
    7474            if not hasattr(e, 'source'):
    7575                e.source = node.source
    7676            raise
     77        except TemplateDoesNotExist, e:
     78            if not hasattr(e, 'source'):
     79                e.source = node.source
     80            raise
    7781        except Exception, e:
    7882            from sys import exc_info
    7983            wrapped = TemplateSyntaxError(u'Caught an exception while rendering: %s' % force_unicode(e, errors='replace'))
Back to Top