reviewboard.reviews.detail¶
Definitions for the review request detail view.
- class ReviewRequestPageData(review_request, request, last_visited=None, entry_classes=None)[source]¶
Bases:
object
Data for the review request page.
The review request detail page needs a lot of data from the database, and going through the standard model relations will result in a lot more queries than necessary. This class bundles all that data together and handles pre-fetching and re-associating as necessary to limit the required number of queries.
All of the attributes within the class may not be available until both
query_data_pre_etag()
andquery_data_post_etag()
are called.This object is not meant to be public API, and may change at any time. You should not use it in extension code.
- body_bottom_replies¶
A mapping from a top-level review ID to a list of the
Review
objects which reply to it.- Type:
- body_top_replies¶
A mapping from a top-level review ID to a list of the
Review
objects which reply to it.- Type:
- review_comments¶
A dictionary of comments across all reviews. The keys are
Review
IDs and the values are lists of comments.- Type:
- draft_body_top_replies¶
A dictionary of draft replies to
body_top
fields across all reviews. The keys are areReview
IDs that are being replied to and the values are lists of replies.- Type:
- draft_body_bottom_replies¶
A dictionary of draft replies to
body_bottom
fields across all reviews. The keys are areReview
IDs that are being replied to and the values are lists of replies.- Type:
- draft_reply_comments¶
A dictionary of draft reply comments across all reviews. The keys are
Review
IDs that are being replied to and the values are lists of reply comments.- Type:
- changedescs¶
All the change descriptions to be shown on the page.
- diffsets¶
All of the diffsets associated with the review request.
- draft¶
The active draft of the review request, if any. May be
None
.
- active file_attachments
All the active file attachments associated with the review request.
- all_file_attachments¶
All the file attachments associated with the review request.
- file_attachments_by_id¶
A mapping from ID to
FileAttachment
- Type:
- issues¶
A list of all the comments (of all types) which are marked as issues.
- issue_counts¶
A dictionary storing counts of the various issue states throughout the page.
- Type:
- latest_changedesc_timestamp¶
The timestamp of the most recent change description on the page.
- Type:
- latest_review_timestamp¶
The timestamp of the most recent review on the page.
- Type:
- latest_timestamps_by_review_id¶
A mapping from top-level review ID to the latest timestamp of the thread.
- Type:
- review_request¶
The review request.
- review_request_details¶
The review request (or the active draft thereof). In practice this will either be a
ReviewRequest
or aReviewRequestDraft
.- Type:
reviewboard.reviews.models.base_review_request_details.BaseReviewRequestDetails
- reviews¶
All the reviews to be shown on the page. This includes any draft reviews owned by the requesting user but not drafts owned by others.
- Type:
list
ofreviewboard.reviews.models.reviews.Review
- active_screenshots¶
All the active screenshots associated with the review request.
- Type:
list
ofreviewboard.reviews.models.screenshots.Screenshot
- all_screenshots¶
All the screenshots associated with the review request.
- screenshots_by_id¶
A mapping from ID to
Screenshot
.- Type:
- all_status_updates¶
All status updates recorded for the review request.
- Type:
list
ofreviewboard.reviews.models.status_updates.StatusUpdate
- initial_status_updates¶
The status updates recorded on the initial publish of the review request.
- Type:
list
ofreviewboard.reviews.models.status_updates.StatusUpdate
- change_status_updates¶
The status updates associated with change descriptions. Each key in the dictionary is a
ChangeDescription
ID, and each key is a list ofreviewboard.reviews.models. status_updates.StatusUpdate
instances.- Type:
- status_updates_enabled¶
Whether the status updates feature is enabled for this review request. This does not necessarily mean that there are status updates on the review request.
- Type:
- __init__(review_request, request, last_visited=None, entry_classes=None)[source]¶
Initialize the data object.
- Parameters:
review_request (
reviewboard.reviews.models.ReviewRequest
) – The review request.request (
django.http.HttpRequest
) – The HTTP request object.last_visited (
datetime.datetime
, optional) – The date/time when the user last visited the review request.entry_classes (
list
ofBaseReviewRequestPageEntry
, optional) – The list of entry classes that should be used for data generation. If not provided, all registered entry classes will be used.
- latest_issue_timestamp: Optional[datetime]¶
The timestamp of the most recent comment, for the issue summary table.
New in version 6.0.
- query_data_pre_etag()[source]¶
Perform initial queries for the page.
This method will populate only the data needed to compute the ETag. We avoid everything else until later so as to do the minimum amount possible before reporting to the client that they can just use their cached copy.
- query_data_post_etag()[source]¶
Perform remaining queries for the page.
This method will populate everything else needed for the display of the review request page other than that which was required to compute the ETag.
- get_entries()[source]¶
Return all entries for the review request page.
This will create and populate entries for the page (based on the entry classes provided in
entry_classes
). The entries can then be injected into the review request page.- Returns:
A dictionary of entries. This has
initial
andmain
keys, corresponding toBaseReviewRequestPageEntry.ENTRY_POS_INITIAL
andBaseReviewRequestPageEntry.ENTRY_POS_MAIN
entries, respectively.The
initial
entries are sorted in registered entry order, while themain
entries are sorted in timestamp order.- Return type:
- __annotations__ = {'latest_issue_timestamp': typing.Optional[datetime.datetime]}¶
- class BaseReviewRequestPageEntry(data, entry_id, added_timestamp, updated_timestamp=None, avatar_user=None)[source]¶
Bases:
object
An entry on the review detail page.
This contains backend logic and frontend templates for one of the boxes that appears below the main review request box on the review request detail page.
- added_timestamp¶
The timestamp of the entry. This represents the added time for the entry, and is used for sorting the entry in the page. This timestamp should never change.
- Type:
- avatar_user¶
The user to display an avatar for. This can be
None
, in which case no avatar will be displayed. Templates can also override the avatar HTML instead of using this.
- entry_id¶
The ID of the entry. This will be unique across this type of entry, and may refer to a database object ID.
- Type:
- updated_timestamp¶
The timestamp when the entry was last updated. This reflects new updates or activity on the entry.
- Type:
- entry_pos = 2[source]¶
The type of entry on the page.
By default, this is a box type, which will appear along with other reviews and change descriptions.
- needs_draft = False[source]¶
Whether the entry needs a review request draft to be queried.
If set,
ReviewRequestPageData.draft
will be set (if a draft exists).
- needs_reviews = False[source]¶
Whether the entry needs reviews, replies, and comments to be queried.
If set,
ReviewRequestPageData.reviews
,ReviewRequestPageData.diffsets
,ReviewRequestPageData.diffsets_by_id
,ReviewRequestPageData.active_file_attachments
,ReviewRequestPageData.all_file_attachments
,ReviewRequestPageData.file_attachments_by_id
,ReviewRequestPageData.active_file_screenshots
,ReviewRequestPageData.all_file_screenshots
, andReviewRequestPageData.file_screenshots_by_id
will be set.
- needs_changedescs = False[source]¶
Whether the entry needs change descriptions to be queried.
If set,
ReviewRequestPageData.changedescs
will be queried.
- needs_status_updates = False[source]¶
Whether the entry needs status updates-related data to be queried.
This will also fetch the reviews, but will not automatically fetch any comments or other related data. For that, set
needs_reviews
.If set,
ReviewRequestPageData.reviews
, If set,ReviewRequestPageData.all_status_updates
, If set,ReviewRequestPageData.initial_status_updates
, and If set,ReviewRequestPageData.change_status_updates
will be set.
- needs_file_attachments = False[source]¶
Whether the entry needs file attachment data to be queried.
If set,
ReviewRequestPageData.active_file_attachments
,ReviewRequestPageData.all_file_attachments
, andReviewRequestPageData.file_attachments_by_id
will be set.
- needs_screenshots = False[source]¶
Whether the entry needs screenshot data to be queried.
Most entries should never need this, as screenshots are deprecated.
If set,
ReviewRequestPageData.active_screenshots
,ReviewRequestPageData.all_screenshots
, andReviewRequestPageData.screenshots_by_id
will be set.
- js_model_class = 'RB.ReviewRequestPage.Entry'[source]¶
The name of the JavaScript Backbone.Model class for this entry.
- js_view_class = 'RB.ReviewRequestPage.EntryView'[source]¶
The name of the JavaScript Backbone.View class for this entry.
- has_content = True[source]¶
Whether this entry has displayable content.
This can be overridden as a property to calculate whether to render the entry, or disabled altogether.
- classmethod build_entries(data)[source]¶
Generate entry instances from review request page data.
Subclasses should override this to yield any entries needed, based on the page data.
- Parameters:
data (
ReviewRequestPageData
) – The data used for the entries on the page.- Yields:
BaseReviewRequestPageEntry
– An entry to include on the page.
- classmethod build_etag_data(data, entry=None, **kwargs)[source]¶
Build ETag data for the entry.
This will be incorporated into the ETag for the page.
Changed in version 4.0.4: Added
entry
and**kwargs
arguments.- Parameters:
data (
ReviewRequestPageData
) – The computed data (pre-ETag) for the page.entry (
BaseReviewRequestPageEntry
) – A specific entry to build ETags for.**kwargs (
dict
, unused) – Additional keyword arguments for future expansion.
- Returns:
The ETag data for the entry.
- Return type:
- __init__(data, entry_id, added_timestamp, updated_timestamp=None, avatar_user=None)[source]¶
Initialize the entry.
- Parameters:
data (
ReviewRequestPageData
) – The computed data for the page.entry_id (
unicode
) – The ID of the entry. This must be unique across this type of entry, and may refer to a database object ID.added_timestamp (
datetime.datetime
) – The timestamp of the entry. This represents the added time for the entry, and is used for sorting the entry in the page. This timestamp should never change.updated_timestamp (
datetime.datetime
, optional) – The timestamp when the entry was last updated. This should reflect new updates or activity on the entry.avatar_user (
django.contrib.auth.models.User
, optional) – The user to display an avatar for. This can beNone
, in which case no avatar will be displayed. Templates can also override the avatar HTML instead of using this.
- __repr__()[source]¶
Return a string representation for this entry.
- Returns:
A string representation for the entry.
- Return type:
- collapsed()[source]¶
Whether the entry is collapsed.
This will consist of a cached value computed from
calculate_collapsed()
. Subclasses should override that method.
- is_entry_new(last_visited, user, **kwargs)[source]¶
Return whether the entry is new, from the user’s perspective.
By default, this compares the last visited time to the timestamp on the object. Subclasses can override this to provide additional logic.
- Parameters:
last_visited (
datetime.datetime
) – The last visited timestamp.user (
django.contrib.auth.models.User
) – The user viewing the page.**kwargs (
dict
) – Additional keyword arguments.
- Returns:
True
if the entry will be shown as new.False
if it will be shown as an existing entry.- Return type:
- calculate_collapsed()[source]¶
Calculate whether the entry should currently be collapsed.
By default, this will collapse the entry if the last update is older than the last time the user visited the entry and older than the last Change Description (or there isn’t one on the page yet).
Subclasses can augment or replace this logic as needed.
- Returns:
True
if the entry should be collapsed.False
if it should be expanded.- Return type:
- get_dom_element_id()[source]¶
Return the ID used for the DOM element for this entry.
By default, this returns
entry_type_id
andentry_id
concatenated. Subclasses should override this if they need something custom.- Returns:
The ID used for the element.
- Return type:
- get_js_model_data()[source]¶
Return data to pass to the JavaScript Model during instantiation.
The data returned from this function will be provided to the model when constructed.
- Returns:
A dictionary of attributes to pass to the Model instance. By default, it will be empty.
- Return type:
- get_js_view_data()[source]¶
Return data to pass to the JavaScript View during instantiation.
The data returned from this function will be provided to the view when constructed.
- Returns:
A dictionary of options to pass to the View instance. By default, it will be empty.
- Return type:
- get_extra_context(request, context)[source]¶
Return extra template context for the entry.
Subclasses can override this to provide additional context needed by the template for the page. By default, this returns an empty dictionary.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.context (
django.template.RequestContext
) – The existing template context on the page.
- Returns:
Extra context to use for the entry’s template.
- Return type:
- render_to_string(request, context)[source]¶
Render the entry to a string.
If the entry doesn’t have a template associated, or doesn’t have any content (as determined by
has_content
), then this will return an empty string.- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.context (
django.template.RequestContext
) – The existing template context on the page.
- Returns:
The resulting HTML for the entry.
- Return type:
- class ReviewEntryMixin[source]¶
Bases:
object
Mixin to provide functionality for entries containing reviews.
- is_review_collapsed(review)[source]¶
Return whether a review should be collapsed.
A review is collapsed if all the following conditions are true:
There are no issues currently waiting to be resolved.
There are no draft replies to any comments or the body fields.
The review has not been seen since the latest activity on it (or seen at all).
- Parameters:
review (
reviewboard.reviews.models.review.Review
) – The review to compute the collapsed state for.- Returns:
True
if the review should be collapsed.False
if not.- Return type:
- serialize_review_js_model_data(review)[source]¶
Serialize information on a review for JavaScript models.
- Parameters:
review (
reviewboard.reviews.models.review.Review
) – The review to serialize.- Returns:
The serialized data for the JavaScript model.
- Return type:
- class DiffCommentsSerializerMixin[source]¶
Bases:
object
Mixin to provide diff comment data serialization.
- serialize_diff_comments_js_model_data(diff_comments)[source]¶
Serialize information on diff comments for JavaScript models.
- Parameters:
diff_comments (
list
ofreviewboard.reviews.models.diff_comment.Comment
) – The list of comments to serialize.- Returns:
The serialized data for the JavaScript model.
- Return type:
- class StatusUpdatesEntryMixin[source]¶
Bases:
DiffCommentsSerializerMixin
,ReviewEntryMixin
A mixin for any entries which can include status updates.
This provides common functionality for the two entries that include status updates (the initial status updates entry and change description entries).
- status_updates¶
The status updates in this entry.
- classmethod build_etag_data(data, entry=None, **kwargs)[source]¶
Build ETag data for the entry.
This will be incorporated into the ETag for the page and for page updates.
ETags are influenced by a status update’s service ID, state, timestamp, and description.
The result will be encoded as a SHA1 hash.
- Parameters:
data (
ReviewRequestPageData
) – The computed data (pre-ETag) for the page.entry (
StatusUpdatesEntryMixin
) – A specific entry to build ETags for.**kwargs (
dict
, unused) – Additional keyword arguments for future expansion.
- Returns:
The ETag data for the entry.
- Return type:
- are_status_updates_collapsed(status_updates)[source]¶
Return whether all status updates should be collapsed.
This considers all provided status updates when computing the collapsed state. It’s meant to be used along with other logic to compute an entry’s collapsed state.
Status updates that are pending or have not yet been seen by the user (assuming they’ve viewed the page at least once) are not collapsed.
Otherwise, the result is based off the review’s collapsed state for each status update. Status updates not containing a review are considered collapsible, and ones containing a review defer to
ReviewEntryMixin.is_review_collapsed()
for a result.- Parameters:
status_updates (
list
ofreviewboard.reviews.models.status_update.StatusUpdate
) – The list of status updates to compute the collapsed state for.- Returns:
True
if all status updates are marked as collapsed.False
if any are not marked as collapsed.- Return type:
- add_update(update)[source]¶
Add a status update to the entry.
- Parameters:
update (
reviewboard.reviews.models.StatusUpdate
) – The status update to add.
- populate_status_updates(status_updates)[source]¶
Populate the list of status updates for the entry.
This will add all the provided status updates and all comments from their reviews. It will also uncollapse the entry if there are any draft replies owned by the user.
- Parameters:
status_updates (
list
ofreviewboard.reviews.models.status_update.StatusUpdate
) – The list of status updates to add.
- add_comment(comment_type, comment)[source]¶
Add a comment to the entry.
This will associate the comment with the correct status update.
- Parameters:
comment_type (
unicode
) – The type of comment (an index into thecomments
dictionary).comment (
reviewboard.reviews.models.BaseComment
) – The comment to add.
- get_js_model_data()[source]¶
Return data to pass to the JavaScript Model during instantiation.
The data returned from this function will be provided to the model when constructed. This consists of information on the reviews for status updates and the comments made on diffs.
- Returns:
A dictionary of attributes to pass to the Model instance.
- Return type:
- __annotations__ = {}¶
- class ReviewRequestEntry(data, entry_id, added_timestamp, updated_timestamp=None, avatar_user=None)[source]¶
Bases:
BaseReviewRequestPageEntry
An entry for the main review request box.
This is used to control the data queried by
ReviewRequestPageData
for display in the main review request box. It does not render onto the page.- entry_pos = 1[source]¶
The type of entry on the page.
By default, this is a box type, which will appear along with other reviews and change descriptions.
- needs_draft = True[source]¶
Whether the entry needs a review request draft to be queried.
If set,
ReviewRequestPageData.draft
will be set (if a draft exists).
- needs_file_attachments = True[source]¶
Whether the entry needs file attachment data to be queried.
If set,
ReviewRequestPageData.active_file_attachments
,ReviewRequestPageData.all_file_attachments
, andReviewRequestPageData.file_attachments_by_id
will be set.
- needs_screenshots = True[source]¶
Whether the entry needs screenshot data to be queried.
Most entries should never need this, as screenshots are deprecated.
If set,
ReviewRequestPageData.active_screenshots
,ReviewRequestPageData.all_screenshots
, andReviewRequestPageData.screenshots_by_id
will be set.
- needs_reviews = True[source]¶
Whether the entry needs reviews, replies, and comments to be queried.
If set,
ReviewRequestPageData.reviews
,ReviewRequestPageData.diffsets
,ReviewRequestPageData.diffsets_by_id
,ReviewRequestPageData.active_file_attachments
,ReviewRequestPageData.all_file_attachments
,ReviewRequestPageData.file_attachments_by_id
,ReviewRequestPageData.active_file_screenshots
,ReviewRequestPageData.all_file_screenshots
, andReviewRequestPageData.file_screenshots_by_id
will be set.
- has_content = False[source]¶
Whether this entry has displayable content.
This can be overridden as a property to calculate whether to render the entry, or disabled altogether.
- __annotations__ = {}¶
- class InitialStatusUpdatesEntry(data)[source]¶
Bases:
StatusUpdatesEntryMixin
,BaseReviewRequestPageEntry
An entry for any status updates posted against the initial state.
StatusUpdate
reviews (those created by automated tools like static analysis checkers or CI systems) are shown separately from ordinary reviews. When status updates are related to aChangeDescription
, they’re displayed within the change description box. Otherwise, they’re shown in their own box (immediately under the review request box), which is handled by this class.- entry_pos = 1[source]¶
The type of entry on the page.
By default, this is a box type, which will appear along with other reviews and change descriptions.
- template_name = 'reviews/entries/initial_status_updates.html'[source]¶
The template to render for the HTML.
- js_model_class = 'RB.ReviewRequestPage.StatusUpdatesEntry'[source]¶
The name of the JavaScript Backbone.Model class for this entry.
- js_view_class = 'RB.ReviewRequestPage.InitialStatusUpdatesEntryView'[source]¶
The name of the JavaScript Backbone.View class for this entry.
- classmethod build_entries(data)[source]¶
Generate the entry instance from review request page data.
This will only generate a single instance.
- Parameters:
data (
ReviewRequestPageData
) – The data used for the initial status update entry.- Yields:
InitialStatusUpdatesEntry
– The entry to include on the page.
- __init__(data)[source]¶
Initialize the entry.
- Parameters:
data (
ReviewRequestPageData
) – Pre-queried data for the review request page.
- property has_content[source]¶
Whether there are any items to display in the entry.
- Returns:
True if there are any initial status updates to display.
- Return type:
- get_dom_element_id()[source]¶
Return the ID used for the DOM element for this entry.
- Returns:
The ID used for the element.
- Return type:
- is_entry_new(last_visited, user, **kwargs)[source]¶
Return whether the entry is new, from the user’s perspective.
The initial status updates entry is basically part of the review request, and is never shown as new.
- Parameters:
last_visited (
datetime.datetime
, unused) – The last visited timestamp.user (
django.contrib.auth.models.User
, unused) – The user viewing the page.**kwargs (
dict
, unused) – Additional keyword arguments.
- Returns:
False
, always.- Return type:
- calculate_collapsed()[source]¶
Calculate whether the entry should currently be collapsed.
The entry will be collapsed if there aren’t yet any Change Descriptions on the page and if there aren’t any status updates with reviews that should be expanded. See
ReviewEntryMixin.is_review_collapsed()
for the collapsing rules for reviews.- Returns:
True
if the entry should be collapsed.False
if it should be expanded.- Return type:
- __annotations__ = {}¶
- class ReviewEntry(data, review)[source]¶
Bases:
ReviewEntryMixin
,DiffCommentsSerializerMixin
,BaseReviewRequestPageEntry
A review box.
- review¶
The review for this entry.
- comments¶
A dictionary of comments. Each key in this represents a comment type, and the values are lists of comment objects.
- Type:
- needs_reviews = True[source]¶
Whether the entry needs reviews, replies, and comments to be queried.
If set,
ReviewRequestPageData.reviews
,ReviewRequestPageData.diffsets
,ReviewRequestPageData.diffsets_by_id
,ReviewRequestPageData.active_file_attachments
,ReviewRequestPageData.all_file_attachments
,ReviewRequestPageData.file_attachments_by_id
,ReviewRequestPageData.active_file_screenshots
,ReviewRequestPageData.all_file_screenshots
, andReviewRequestPageData.file_screenshots_by_id
will be set.
- js_model_class = 'RB.ReviewRequestPage.ReviewEntry'[source]¶
The name of the JavaScript Backbone.Model class for this entry.
- js_view_class = 'RB.ReviewRequestPage.ReviewEntryView'[source]¶
The name of the JavaScript Backbone.View class for this entry.
- classmethod build_entries(data)[source]¶
Generate review entry instances from review request page data.
- Parameters:
data (
ReviewRequestPageData
) – The data used for the entries on the page.- Yields:
ReviewEntry
– A review entry to include on the page.
- __init__(data, review)[source]¶
Initialize the entry.
- Parameters:
data (
ReviewRequestPageData
) – Pre-queried data for the review request page.review (
reviewboard.reviews.models.Review
) – The review.
- get_dom_element_id()[source]¶
Return the ID used for the DOM element for this entry.
- Returns:
The ID used for the element.
- Return type:
- is_entry_new(last_visited, user, **kwargs)[source]¶
Return whether the entry is new, from the user’s perspective.
- Parameters:
last_visited (
datetime.datetime
) – The last visited timestamp.user (
django.contrib.auth.models.User
) – The user viewing the page.**kwargs (
dict
, unused) – Additional keyword arguments.
- Returns:
True
if the entry will be shown as new.False
if it will be shown as an existing entry.- Return type:
- add_comment(comment_type, comment)[source]¶
Add a comment to this entry.
- Parameters:
comment_type (
unicode
) – The type of comment (an index into thecomments
dictionary).comment (
reviewboard.reviews.models.BaseComment
) – The comment to add.
- get_js_model_data()[source]¶
Return data to pass to the JavaScript Model during instantiation.
The data returned from this function will be provided to the model when constructed. This consists of information on the review and the comments made on diffs.
- Returns:
A dictionary of attributes to pass to the Model instance.
- Return type:
- calculate_collapsed()[source]¶
Calculate whether the entry should currently be collapsed.
The entry will be collapsed if the review is marked as collapsed. See
ReviewEntryMixin.is_review_collapsed()
for the collapsing rules for reviews.- Returns:
True
if the entry should be collapsed.False
if it should be expanded.- Return type:
- __annotations__ = {}¶
- class ChangeEntry(data, changedesc)[source]¶
Bases:
StatusUpdatesEntryMixin
,BaseReviewRequestPageEntry
A change description box.
- changedesc¶
The change description for this entry.
- needs_changedescs = True[source]¶
Whether the entry needs change descriptions to be queried.
If set,
ReviewRequestPageData.changedescs
will be queried.
- needs_file_attachments = True[source]¶
Whether the entry needs file attachment data to be queried.
If set,
ReviewRequestPageData.active_file_attachments
,ReviewRequestPageData.all_file_attachments
, andReviewRequestPageData.file_attachments_by_id
will be set.
- needs_screenshots = True[source]¶
Whether the entry needs screenshot data to be queried.
Most entries should never need this, as screenshots are deprecated.
If set,
ReviewRequestPageData.active_screenshots
,ReviewRequestPageData.all_screenshots
, andReviewRequestPageData.screenshots_by_id
will be set.
- js_model_class = 'RB.ReviewRequestPage.ChangeEntry'[source]¶
The name of the JavaScript Backbone.Model class for this entry.
- js_view_class = 'RB.ReviewRequestPage.ChangeEntryView'[source]¶
The name of the JavaScript Backbone.View class for this entry.
- classmethod build_entries(data)[source]¶
Generate change entry instances from review request page data.
- Parameters:
data (
ReviewRequestPageData
) – The data used for the entries on the page.- Yields:
ChangeEntry
– A change entry to include on the page.
- __init__(data, changedesc)[source]¶
Initialize the entry.
- Parameters:
data (
ReviewRequestPageData
) – Pre-queried data for the review request page.changedesc (
reviewboard.changedescs.models.ChangeDescription
) – The change description for this entry.
- get_dom_element_id()[source]¶
Return the ID used for the DOM element for this entry.
- Returns:
The ID used for the element.
- Return type:
- is_entry_new(last_visited, user, **kwargs)[source]¶
Return whether the entry is new, from the user’s perspective.
- Parameters:
last_visited (
datetime.datetime
) – The last visited timestamp.user (
django.contrib.auth.models.User
) – The user viewing the page.**kwargs (
dict
, unused) – Additional keyword arguments.
- Returns:
True
if the entry will be shown as new.False
if it will be shown as an existing entry.- Return type:
- __annotations__ = {}¶
- calculate_collapsed()[source]¶
Calculate whether the entry should currently be collapsed.
The entry will be collapsed if the timestamp of the Change Description is older than that of the most recent Change Description and there aren’t any status updates with reviews that should be expanded. see
ReviewEntryMixin.is_review_collapsed()
for the collapsing rules for reviews.- Returns:
True
if the entry should be collapsed.False
if it should be expanded.- Return type:
- class ReviewRequestPageEntryRegistry[source]¶
Bases:
OrderedRegistry
A registry for types of entries on the review request page.
- __annotations__ = {}¶
- __parameters__ = ()¶
- lookup_attrs: Sequence[str] = ['entry_type_id'][source]¶
A list of attributes that items can be looked up by.
- errors: RegistryErrorsDict = {'already_registered': 'This review request page entry is already registered.', 'attribute_registered': 'A review request page entry with the entry_type_id "%(attr_value)s" is already registered by another entry (%(duplicate)s).', 'not_registered': '"%(attr_value)s" is not a registered review request page entry ID.'}[source]¶
Error formatting strings for exceptions.
Entries here override the global
DEFAULT_ERRORS
dictionary for error messages.- Type: