コード例 #1
0
    def renderFailure(self, failure, request):
        try:
            xml = request.d.toprettyxml()
        except:
            xml = ""


#         if not hasattr(request, 'channel'):
#             log.msg("The request got away from me before I could render an error page.")
#             log.err(failure)
#             return failure
        if not self.failed:
            self.failed = 1
            if failure:
                request.write(
                    "<html><head><title>%s: %s</title></head><body>\n" %
                    (html.escape(str(
                        failure.type)), html.escape(str(failure.value))))
            else:
                request.write(
                    "<html><head><title>Failure!</title></head><body>\n")
            utils.renderFailure(failure, request)
            request.write("<h3>Here is the partially processed DOM:</h3>")
            request.write("\n<pre>\n")
            request.write(html.escape(xml))
            request.write("\n</pre>\n")
            request.write("</body></html>")
            request.finish()
        return failure
コード例 #2
0
 def renderFailure(self, failure, request):
     try:
         xml = request.d.toprettyxml()
     except:
         xml = ""
     if not self.failed:
         self.failed = 1
         if failure:
             request.write("<html><head><title>%s: %s</title></head><body>\n" % (html.escape(str(failure.type)), html.escape(str(failure.value))))
         else:
             request.write("<html><head><title>Failure!</title></head><body>\n")
         utils.renderFailure(failure, request)
         request.write("<h3>Here is the partially processed DOM:</h3>")
         request.write("\n<pre>\n")
         request.write(html.escape(xml))
         request.write("\n</pre>\n")
         request.write("</body></html>")
         request.finish()
     return failure
コード例 #3
0
    def renderFailure(self, failure, request):
        try:
            xml = request.d.toprettyxml()
        except:
            xml = ""
#         if not hasattr(request, 'channel'):
#             log.msg("The request got away from me before I could render an error page.")
#             log.err(failure)
#             return failure
        if not self.failed:
            self.failed = 1
            if failure:
                request.write("<html><head><title>%s: %s</title></head><body>\n" % (html.escape(str(failure.type)), html.escape(str(failure.value))))
            else:
                request.write("<html><head><title>Failure!</title></head><body>\n")
            utils.renderFailure(failure, request)
            request.write("<h3>Here is the partially processed DOM:</h3>")
            request.write("\n<pre>\n")
            request.write(html.escape(xml))
            request.write("\n</pre>\n")
            request.write("</body></html>")
            request.finish()
        return failure