Utils Http
inyoka.utils.http
This module contains functions for http-related things like special responses etc.
- copyright:
2007-2024 by the Inyoka Team, see AUTHORS for more details.
- license:
BSD, see LICENSE for more details.
- inyoka.utils.http.bad_request_view(request, exception=None)
- inyoka.utils.http.does_not_exist_is_404(f)
For untemplated pages a DoesNotExist to 404.
- inyoka.utils.http.global_not_found(request, err_message=None, exception=None)
- inyoka.utils.http.permission_denied_view(request, exception=None)
- inyoka.utils.http.server_error(request, exception=None)
- inyoka.utils.http.templated(template_name, status=None, modifier=None, content_type='text/html; charset=utf-8')
This function can be used as a decorator to use a function’s return value as template context if it’s not a valid Response object. The first decorator argument should be the name of the template to use:
@templated('mytemplate.html') def foo(req): return { 'foo': 'bar' }
ObjectDoesNotExist exceptions are caught and raised again as PageNotFound.