Jump to >

djblets.views.generic.etag

Mixin for class-based views that support ETags.

class ETagViewMixin[source]

Bases: object

Mixin to handle ETag generation for a page.

This enables ETag support in the view for HTTP GET requests. On a request, get_etag_data() will be called, which will calculate an ETag for the content. If the client already knows this ETag, it will receive a HTTP 304 Not Modified. Otherwise, it will return a response with that ETag attached.

This currently only supports ETags for HTTP GET and HEAD methods.

dispatch(request, *args, **kwargs)[source]

Handle a HTTP request and dispatch to a handler.

Parameters:
  • request (django.http.HttpRequest) – The HTTP request from the client.
  • *args (tuple) – Positional arguments passed to the handler.
  • **kwargs (dict) – Keyword arguments passed to the handler.
Returns:

The resulting HTTP response from the handler.

Return type:

django.http.HttpResponse