Edgewall Software

Opened 17 years ago

Closed 17 years ago

#147 closed defect (fixed)

Includes with fallback will fail when loader.auto_reload=True

Reported by: rintaro@… Owned by: cmlenz
Priority: major Milestone: 0.5
Component: Template processing Version: devel
Keywords: Cc:

Description

Testcase for MarkupTemplateTestCase?:

    def test_fallback_when_auto_reload_true(self):
        dirname = tempfile.mkdtemp(suffix='genshi_test')
        try:
            file2 = open(os.path.join(dirname, 'tmpl2.html'), 'w')
            try:
                file2.write("""<html xmlns:xi="http://www.w3.org/2001/XInclude">
                  <xi:include href="tmpl1.html"><xi:fallback>
                    Missing</xi:fallback></xi:include>
                </html>""")
            finally:
                file2.close()

            loader = TemplateLoader([dirname], auto_reload=True)
            tmpl = loader.load('tmpl2.html')
            self.assertEqual("""<html>
                  <div>Included</div>
                </html>""", tmpl.generate().render())
        finally:
            shutil.rmtree(dirname)

Here is a patch:

  • genshi/template/base.py

     
    409409                        continue
    410410                    elif fallback:
    411411                        # Otherwise the include is performed at run time
    412                         data = href, list(self._prepare(fallback))
     412                        data = href, cls, list(self._prepare(fallback))
    413413
    414414                yield kind, data, pos

Change History (1)

comment:1 Changed 17 years ago by cmlenz

  • Component changed from General to Template processing
  • Resolution set to fixed
  • Status changed from new to closed

Applied in [755]. Thanks!

Note: See TracTickets for help on using tickets.