API documentation for twod.wsgi¶
Enhanced WSGI support for Django applications.
-
class
twod.wsgi.DjangoApplication¶ Bases:
django.core.handlers.wsgi.WSGIHandlerDjango request handler which uses our enhanced WSGI request class.
-
request_class¶ alias of
TwodWSGIRequest
-
-
class
twod.wsgi.TwodResponse(content='', mimetype=None, status=None, *args, **kwargs)¶ Bases:
django.http.HttpResponseDjango-based response class which keeps the HTTP status reason phrase.
The original implementation in Django simply keeps the status code and does not allow developers to use custom HTTP status reason phrase, which is explicitly allowed by the HTTP specification: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html
-
class
twod.wsgi.handler.TwodWSGIRequest(environ)¶ Bases:
django.core.handlers.wsgi.WSGIRequest,webob.request.RequestPythonic proxy for the WSGI environment.
This class is the Django request extended by WebOb’s request. Where they both have the same members, Django’s take precedence. For example,
.GETusesdjango.core.handlers.wsgi.WSGIRequest.GETinstead ofwebob.Request.GET.To access WebOb’s GET and POST dictionaries, you have to use
.uGETand.uPOSTrespectively.
Embedded applications¶
-
twod.wsgi.make_wsgi_view(wsgi_app)¶ Return a callable which can be used as a Django view powered by the
wsgi_app.Parameters: wsgi_app – The WSGI which will run the view. Returns: The view callable.
-
twod.wsgi.call_wsgi_app(wsgi_app, request, path_info)¶ Call the
wsgi_appwithrequestand return its response.Parameters: - wsgi_app (callable) – The WSGI application to be run.
- request (
twod.wsgi.handler.TwodWSGIRequest) – The Django request. - path_info – The
PATH_INFOto be used by the WSGI application.
Raises twod.wsgi.exc.ApplicationCallError: If
path_infois not the last portion of thePATH_INFOinrequest.Returns: The response from the WSGI application, turned into a Django response.
Return type:
Media serving¶
-
twod.wsgi.factories.add_media_to_app(django_app)¶ Return a WSGI application made up of the Django application, its media and the Django Admin media.
Exceptions¶
Exceptions raised by twod.wsgi.
-
exception
twod.wsgi.exc.ApplicationCallError¶ Bases:
twod.wsgi.exc.TwodWSGIExceptionException raised when an embedded WSGI application was not called properly.
-
exception
twod.wsgi.exc.TwodWSGIException¶ Bases:
exceptions.ExceptionBase class for exceptions raised by
twod.wsgi.