    def finish_output(self, output, request, path):
        """
        Alle HTML-Seiten werden mit html-tidy überprüft.
        Tippfehler oder ähnliches werden so schnell
        entdeckt.
        """
        c_type=request.response.headers.get("content-type")
        if (not c_type or c_type=="text/html") and type(output)==StringType:
            self.html_tidy(output, path)
        return output
    
    def html_tidy(self, output, url):
        """
        Small hack to call html-tidy for every html
        page which is serverd by quixote.

        It is used for checking the html syntax only, the html
        output won't be changed.
        """
        prog="tidy"
        found=None
        path_list=os.environ.get("PATH", "").split(":")
        for path in path_list:
            path=path.strip()
            prog_abs=os.path.join(path, prog)
            if os.path.exists(prog_abs):
                found=prog_abs
                break
        if not found:
            log("html-tidy not found in path: %s" % path_list)
            return
        ignore=[
            'Warning: <table> lacks "summary" attribute',
            "Can't open",
            "Warning: <nobr> is not approved by W3C",
            "Warning: missing <!DOCTYPE> declaration",
            "Warning: trimming empty <pre>",
            "Warning: trimming empty <option>",
            "Warning: inserting missing 'title' element",
            "This document has errors that must be fixed before",
            "using HTML Tidy to generate a tidied up version",
            'Warning: <table> proprietary attribute "height"',
            # Bug in tidy:
            'Warning: <frameset> attribute "rows" has invalid value',

            # The following lines are needed for old tidy versions:
            "The table summary attribute should be used to describe",
            "the table structure. It is very helpful for people using",
            "non-visual browsers. The scope and headers attributes for",
            "table cells are useful for specifying which headers apply",
            "to each table cell, enabling non-visual browsers to provide",
            "a meaningful context for each cell.",
            "For further advice on how to make your pages accessible",
            'see "http://www.w3.org/WAI/GL". You may also want to try',
            '"http://www.cast.org/bobby/" which is a free Web-based',
            "service for checking URLs for accessibility.",
            "You are recommended to use CSS to control line wrapping.",
            'Use "white-space: nowrap" to inhibit wrapping in place',
            "of inserting <NOBR>...</NOBR> into the markup.",
            "HTML & CSS specifications are available from http://www.w3.org/",
            "To learn more about Tidy see http://www.w3.org/People/Raggett/",
            "Please send bug reports to Dave Raggett care of ",
            "Lobby your company to join W3C, see http://www.w3.org/Consortium",
            "Pages designed using frames presents problems for",
            "people who are either blind or using a browser that",
            "doesn't support frames. A frames-based page should alw",
            "include an alternative layout inside a NOFRAMES elemen"
            ]
        htmlfile=tempfile.mktemp()
        fd=open(htmlfile, "wt")
        fd.write(output)
        fd.close()
        stdout, stdin = popen2.popen4("tidy -q -errors '%s'" % htmlfile)
        out=stdout.readlines()

        try:
            os.unlink(htmlfile)
        except OSError:
            # Does occure sometimes. Reason unkown
            log("HTML-Tidy: cannot delete %s." % htmlfile)

        for line in out:
            line=line.strip()
            if not line:
                continue
            cont=0
            for ign in ignore:
                if line.find(ign)!=-1:
                    cont=1
                    continue
            if cont:
                continue
            log("HTML-Tidy %s: %s" % (
                url, line))

        
    
