Issue #352 resolved

Bug in getErrorPage(status, **kwargs)

Anonymous created an issue

In '''getErrorPage''' function is possible bug. I tried tutorial pages and didn't make expected result for custom error page. It is because:



if errorPageFile:
        template = file(errorPageFile, 'rb')

}}} but I thing there must be: {{{


if errorPageFile:
        template = file(errorPageFile, 'rb').read()

}}} because then it raise exception here: {{{


return template % kwargs

}}} '''template''' is type of file... BR

BR In the same tutorial is code that doesn't generate expected: {{{


def bodyArg(self):
    message = """ If you construct a HTTPError wiht body argument, the body argument
                  will overide any default or custom error page.
    raise cherrypy.HTTPError(403, message = message)

}}} But on the beggining you set custom error for 403 and message is overloaded by code of '''getErrorPage'''. There are two choices to solve this: * change getErrorPage {{{


if errorPageFile and message:

}}} * change tutorial to different error code {{{


    raise cherrypy.HTTPError(500, message = message)


Reported by

Comments (2)

  1. Log in to comment