changeset 629:cae74e2637c6

Revert second part of [726] (error on includes when no loader specified), which broke I18n extraction via the Babel plugin.
author cmlenz
date Tue, 04 Sep 2007 11:51:58 +0000
parents 693a7212b348
children 8bb5abd0a1dc
files ChangeLog README.txt genshi/template/markup.py genshi/template/tests/markup.py genshi/template/tests/text.py genshi/template/text.py
diffstat 6 files changed, 6 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,8 +33,6 @@
    set to "xml" (the default), the include is processed as before, but when set
    to "text", the included template is parsed as a text template using the new
    syntax (ticket #101).
- * If an include is found when parsing a template, but no template loader has
-   been specified, a `TemplateSyntaxError` is raised.
 
 
 Version 0.4.4
--- a/README.txt
+++ b/README.txt
@@ -1,11 +1,12 @@
 About Genshi
 ============
 
-Genshi is a Python library that provides an integrated set of components
-for parsing, generating, and processing HTML, XML or other textual
-content for output generation on the web. The major feature is a
-template language, which is heavily inspired by Kid.
+Genshi is a Python library that provides an integrated set of
+components for parsing, generating, and processing HTML, XML or other
+textual content for output generation on the web. The major feature is
+a template language, which is heavily inspired by Kid.
 
-For more information please see the documentation in the `doc` directory, and visit the Genshi web site:
+For more information please see the documentation in the `doc`
+directory, and visit the Genshi web site:
 
   <http://genshi.edgewall.org/>
--- a/genshi/template/markup.py
+++ b/genshi/template/markup.py
@@ -142,10 +142,6 @@
                     dirmap[(depth, tag)] = (directives, len(stream), strip)
 
                 if tag in self.XINCLUDE_NAMESPACE:
-                    if self._include not in self.filters:
-                        raise TemplateSyntaxError('Include found but no '
-                                                  'template loader specified',
-                                                  self.filepath, *pos[1:])
                     if tag.localname == 'include':
                         include_href = new_attrs.get('href')
                         if not include_href:
--- a/genshi/template/tests/markup.py
+++ b/genshi/template/tests/markup.py
@@ -244,12 +244,6 @@
           <Item/>
         </Test>""", str(tmpl.generate()))
 
-    def test_include_without_loader(self):
-        xml = """<html xmlns:xi="http://www.w3.org/2001/XInclude">
-          <xi:include href="oops.html" />
-        </html>"""
-        self.assertRaises(TemplateSyntaxError, MarkupTemplate, xml)
-
     def test_include_in_loop(self):
         dirname = tempfile.mkdtemp(suffix='genshi_test')
         try:
--- a/genshi/template/tests/text.py
+++ b/genshi/template/tests/text.py
@@ -112,10 +112,6 @@
             ----- Included data above this line -----""",
                          tmpl.generate().render())
 
-    def test_include_without_loader(self):
-        text = '#include "oops.html"'
-        self.assertRaises(TemplateSyntaxError, OldTextTemplate, text)
-
 
 class NewTextTemplateTestCase(unittest.TestCase):
     """Tests for text template processing."""
@@ -236,10 +232,6 @@
 Included
 ----- Included data above this line -----""", tmpl.generate().render())
 
-    def test_include_without_loader(self):
-        text = '{% include "oops.html" %}'
-        self.assertRaises(TemplateSyntaxError, NewTextTemplate, text)
-
 
 def suite():
     suite = unittest.TestSuite()
--- a/genshi/template/text.py
+++ b/genshi/template/text.py
@@ -187,10 +187,6 @@
             command, value = mo.group(2, 3)
 
             if command == 'include':
-                if self._include not in self.filters:
-                    raise TemplateSyntaxError('Include found but no template '
-                                              'loader specified', self.filepath,
-                                              lineno)
                 pos = (self.filename, lineno, 0)
                 stream.append((INCLUDE, (value.strip(), None, []), pos))
 
@@ -311,10 +307,6 @@
                     stream[start_offset:] = [(SUB, ([directive], substream),
                                               (self.filepath, lineno, 0))]
             elif command == 'include':
-                if self._include not in self.filters:
-                    raise TemplateSyntaxError('Include found but no template '
-                                              'loader specified', self.filepath,
-                                              lineno)
                 pos = (self.filename, lineno, 0)
                 stream.append((INCLUDE, (value.strip(), None, []), pos))
             elif command != '#':
Copyright (C) 2012-2017 Edgewall Software