I have made a 404 error handler in __init__.py that works fine:
@ombott.error(404, "/<params:path>")
def error404(route, params):
entrada = str(route)
ombott.response.status = 404
return """
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Not Found</title>
<link rel="icon" type="image/ico" href="/static/favicon.ico">
</head>
<body>
<div align='center'>
<h2 style="text-align:center;font-family:monospace;">404 Not Found</h2>
<p style="text-align:center;font-family:monospace;">{}</p>
<a href="/index">
<button type="button">Inicio</button></a>
</div>
</body>
</html>
""".format(
entrada
)
I tried to do the same with 500 and 403 exceptions but with 500 the default page of py4web arises and a blank page with 403.
Have anyone done it? Is there any way to route the raise HTTP(code) to a specific controller?
Thanks