Ticket #7876: 7876.patch

File 7876.patch, 1.1 KB (added by Matthias Kestenholz, 16 years ago)
  • django/template/__init__.py

    diff --git a/django/template/__init__.py b/django/template/__init__.py
    index 5c4ab30..6365243 100644
    a b class Parser(object):  
    266266                try:
    267267                    compile_func = self.tags[command]
    268268                except KeyError:
    269                     self.invalid_block_tag(token, command)
     269                    self.invalid_block_tag(token, command, parse_until)
    270270                try:
    271271                    compiled_result = compile_func(self, token)
    272272                except TemplateSyntaxError, e:
    class Parser(object):  
    317317    def empty_block_tag(self, token):
    318318        raise self.error(token, "Empty block tag")
    319319
    320     def invalid_block_tag(self, token, command):
     320    def invalid_block_tag(self, token, command, parse_until=None):
     321        if parse_until:
     322            raise self.error(token, "Invalid block tag: '%s', expected one of '%s'" % (command, "', '".join(parse_until)))
    321323        raise self.error(token, "Invalid block tag: '%s'" % command)
    322324
    323325    def unclosed_block_tag(self, parse_until):
Back to Top