reviewboard.reviews.views.review_request_updates¶
View for sending data for updating the review request page.
- class ReviewRequestUpdatesView(**kwargs)[source]¶
Bases:
ReviewRequestViewMixin
,ETagViewMixin
,ContextMixin
,View
Internal view for sending data for updating the review request page.
This view serializes data representing components of the review request page (the issue summary table and entries) that need to periodically update without a full page reload. It’s used internally by the page to request and handle updates.
The resulting format is a custom, condensed format containing metadata information and HTML for each component being updated. It’s designed to be quick to parse and reduces the amount of data to send across the wire (unlike a format like JSON, which would add overhead to the serialization/deserialization time and data size when storing HTML).
Each entry in the payload is in the following format, with all entries joined together:
<metadata length>n <metadata content> <html length>n <html content>
The format is subject to change without notice, and should not be relied upon by third parties.
- __init__(**kwargs) None [source]¶
Initialize the view.
- Parameters:
**kwargs (
tuple
) – Keyword arguments passed toas_view()
.
- pre_dispatch(request: HttpRequest, *args, **kwargs) Optional[HttpResponse] [source]¶
Look up and validate state before dispatching the request.
This looks up information based on the request before performing any ETag generation or otherwise handling the HTTP request.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.*args (
tuple
, unused) – Positional arguments passsed to the view.**kwargs (
dict
, unused) – Keyword arguments passed to the view.
- Returns:
The HTTP response containing the updates payload.
- Return type:
- Raises:
Http404 – The entry state could not be loaded.
- get_etag_data(request: HttpRequest, *args, **kwargs) str [source]¶
Return an ETag for the view.
This will look up state needed for the request and generate a suitable ETag. Some of the information will be stored for later computation of the payload.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.*args (
tuple
, unused) – Positional arguments passsed to the handler.**kwargs (
dict
, unused) – Keyword arguments passed to the handler.
- Returns:
The ETag for the page.
- Return type:
- get(request: HttpRequest, **kwargs) HttpResponse [source]¶
Handle HTTP GET requests for this view.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.**kwargs (
dict
) – Keyword arguments passed to the handler.
- Returns:
The HTTP response to send to the client. This will contain the custom update payload content.
- Return type:
- __annotations__ = {}¶