Jump to >

reviewboard.reviews.models

class BaseComment(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The base class for all comment types.

OPEN = u'O'[source]
RESOLVED = u'R'[source]
DROPPED = u'D'[source]
VERIFYING_RESOLVED = u'A'[source]
VERIFYING_DROPPED = u'B'[source]
ISSUE_STATUSES = ((u'O', _(u'Open')), (u'R', _(u'Resolved')), (u'D', _(u'Dropped')), (u'A', _(u'Waiting for verification to resolve')), (u'B', _(u'Waiting for verification to drop')))[source]
ISSUE_STATUS_TO_STRING = {u'A': u'verifying-resolved', u'B': u'verifying-dropped', u'D': u'dropped', u'O': u'open', u'R': u'resolved'}[source]
ISSUE_STRING_TO_STATUS = {u'dropped': u'D', u'open': u'O', u'resolved': u'R', u'verifying-dropped': u'B', u'verifying-resolved': u'A'}[source]
reply_to[source]
objects
static issue_status_to_string()[source]

Return a string representation of the status field.

Parameters:status (unicode) – The value of the issue_status field.
Returns:A string representation of the status used for the API and other interfaces.
Return type:unicode
static issue_string_to_status()[source]

Return a DB representation of the given status string.

Parameters:status (unicode) – The status string to convert.
Returns:A value suitable for storing in the issue_status field.
Return type:unicode
require_verification[source]

Whether this comment requires verification before closing.

__init__(*args, **kwargs)[source]

Initialize the comment.

Parameters:
  • *args (tuple) – Positional arguments to pass through to the model initialization.
  • **kwargs (dict) – Keyword arguments to pass through to the model initialization.
get_review_request()[source]

Return this comment’s review request.

Returns:The review request that this comment was made on.
Return type:reviewboard.reviews.models.review_request.ReviewRequest
get_review()[source]

Return this comment’s review.

Returns:The review containing this comment.
Return type:reviewboard.reviews.models.review.Review
get_review_url()[source]

Return the URL to view this comment.

Returns:The absolute URL to view this comment in the web UI.
Return type:unicode
is_reply()[source]

Return whether this comment is a reply to another comment.

Returns:True if the comment is a reply.
Return type:bool
is_accessible_by(user)[source]

Return whether the user can access this comment.

Parameters:user (django.contrib.auth.models.User) – The user being checked.
Returns:True if the given user can access this comment.
Return type:bool
is_mutable_by(user)[source]

Return whether the user can modify this comment.

Parameters:user (django.contrib.auth.models.User) – The user being checked.
Returns:True if the given user can modify this comment.
Return type:bool
public_replies(user=None)[source]

Return the public replies to this comment.

Parameters:user (django.contrib.auth.models.User, optional) – A user to filter by, if desired. If specified, only replies authored by this user will be returned.
Returns:The public replies to this comment.
Return type:list of reviewboard.reviews.models.base_comment.BaseComment
can_change_issue_status(user)[source]

Return whether the user can change the issue status.

Currently, this is allowed for: - The user who owns the review request. - The user who opened the issue (posted the comment).

Parameters:user (django.contrib.auth.models.User) – The user being checked.
Returns:True if the given user is allowed to change the issue status.
Return type:bool
can_verify_issue_status(user)[source]

Return whether the user can verify the issue status.

Currently this is allowed for:

  • The user who opened the issue.
  • Administrators.
Parameters:user (django.contrib.auth.models.User) – The user being checked.
Returns:True if the given user is allowed to verify the issue status.
Return type:bool
save(**kwargs)[source]

Save the comment.

Parameters:**kwargs (dict) – Keyword arguments passed to the method (unused).
__str__()[source]
class Meta[source]
abstract = False[source]
app_label = u'reviews'[source]
ordering = [u'timestamp'][source]
__unicode__()[source]

Return a string representation of the comment.

Returns:A string representation of the comment.
Return type:unicode
get_extra_data_json()[source]
get_issue_status_display(**morekwargs)[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
set_extra_data_json(json)[source]
class Comment(*args, **kwargs)[source]

Bases: reviewboard.reviews.models.base_comment.BaseComment

A comment made on a diff.

A comment can belong to a single filediff or to an interdiff between two filediffs. It can also have multiple replies.

anchor_prefix = u'comment'[source]
comment_type = u'diff'[source]
filediff[source]
interfilediff[source]
last_line[source]
get_absolute_url(**morekwargs)[source]
get_extra_data_json()[source]
get_issue_status_display(**morekwargs)[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
objects = <djblets.db.managers.ConcurrencyManager object>[source]
replies[source]
reply_to[source]
review[source]
set_extra_data_json(json)[source]
class DefaultReviewer(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Represents reviewers automatically added to review requests.

A default reviewer entry automatically adds default reviewers to a review request when the diff modifies a file matching the file_regex pattern specified.

This is useful when different groups own different parts of a codebase. Adding DefaultReviewer entries ensures that the right people will always see the review request and discussions.

A file_regex of ".*" will add the specified reviewers by default for every review request.

Note that this is keyed off the same LocalSite as its “repository” member.

repository[source]
groups[source]
people[source]
local_site[source]
objects = <reviewboard.reviews.managers.DefaultReviewerManager object>[source]
is_accessible_by(user)[source]

Returns whether the user can access this default reviewer.

is_mutable_by(user)[source]

Returns whether the user can modify or delete this default reviewer.

Only those with the default_reviewer.change_group permission (such as administrators) can modify or delete default reviewers not bound to a LocalSite.

LocalSite administrators can modify or delete them on their LocalSites.

__str__()[source]
__unicode__()[source]
class FileAttachmentComment(*args, **kwargs)[source]

Bases: reviewboard.reviews.models.base_comment.BaseComment

A comment on a file attachment.

anchor_prefix = u'fcomment'[source]
comment_type = u'file'[source]
file_attachment[source]
diff_against_file_attachment[source]
review_ui[source]

Decorator that converts a method with a single self argument into a property cached on the instance.

thumbnail[source]

Returns the thumbnail for this comment, if any, as HTML.

The thumbnail will be generated from the appropriate ReviewUI, if there is one for this type of file.

get_absolute_url(**morekwargs)[source]

Returns the URL for this comment.

Returns the text for the link to the file.

get_extra_data_json()[source]
get_issue_status_display(**morekwargs)[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
objects = <djblets.db.managers.ConcurrencyManager object>[source]
replies[source]
reply_to[source]
review[source]
set_extra_data_json(json)[source]
class GeneralComment(*args, **kwargs)[source]

Bases: reviewboard.reviews.models.base_comment.BaseComment

A comment on a review request that is not tied to any code or file.

A general comment on a review request is used when a comment is not tied to specific lines of code or a special file attachment, and an issue is opened. Examples include suggestions for testing or pointing out errors in the change description.

anchor_prefix = u'gcomment'[source]
comment_type = u'general'[source]
get_absolute_url(**morekwargs)[source]
get_extra_data_json()[source]
get_issue_status_display(**morekwargs)[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
objects = <djblets.db.managers.ConcurrencyManager object>[source]
replies[source]
reply_to[source]
review[source]
set_extra_data_json(json)[source]
class Group(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A group of people who can be targetted for review.

This is usually used to separate teams at a company or components of a project.

Each group can have an e-mail address associated with it, sending all review requests and replies to that address. If that e-mail address is blank, e-mails are sent individually to each member of that group.

users[source]
local_site[source]
incoming_request_count = <djblets.db.fields.counter_field.CounterField: incoming_request_count>[source]
objects = <reviewboard.reviews.managers.ReviewGroupManager object>[source]
is_accessible_by(user, request=None, silent=False)[source]

Returns true if the user can access this group.

is_mutable_by(user)[source]

Returns whether or not the user can modify or delete the group.

The group is mutable by the user if they are an administrator with proper permissions, or the group is part of a LocalSite and the user is in the admin list.

__str__()[source]
get_absolute_url(**morekwargs)[source]
clean()[source]

Clean method for checking null unique_together constraints.

Django has a bug where unique_together constraints for foreign keys aren’t checked properly if one of the relations is null. This means that users who aren’t using local sites could create multiple groups with the same name.

__unicode__()[source]
decrement_incoming_request_count(*args, **kwargs)[source]
defaultreviewer_set[source]
drafts[source]
get_extra_data_json()[source]
increment_incoming_request_count(*args, **kwargs)[source]
reinit_incoming_request_count()[source]
reload_incoming_request_count()[source]
repositories[source]
review_requests[source]
set_extra_data_json(json)[source]
starred_by[source]
class Review(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A review of a review request.

SHIP_IT_TEXT = u'Ship It!'[source]
REVOKED_SHIP_IT_TEXT = u'~~Ship It!~~'[source]
FIX_IT_THEN_SHIP_IT_TEXT = u'Fix it, then Ship it!'[source]
review_request[source]
user[source]
base_reply_to[source]
body_top_reply_to[source]
body_bottom_reply_to[source]
comments[source]
screenshot_comments[source]
file_attachment_comments[source]
general_comments[source]
reviewed_diffset[source]
objects = <reviewboard.reviews.managers.ReviewManager object>[source]
ship_it_only[source]

Decorator that converts a method with a single self argument into a property cached on the instance.

can_user_revoke_ship_it(user)[source]

Return whether a given user can revoke a Ship It.

Parameters:user (django.contrib.auth.models.User) – The user to check permissions for.
Returns:True if the user has permissions to revoke a Ship It. False if they don’t.
Return type:bool
revoke_ship_it(user)[source]

Revoke the Ship It status on this review.

The Ship It status will be removed, and the ReviewRequest.shipit_count counter will be decremented.

If the body_top text is equal to SHIP_IT_TEXT, then it will replaced with REVOKED_SHIP_IT_TEXT.

Callers are responsible for checking whether the user has permission to revoke Ship Its by using can_user_revoke_ship_it().

Raises:reviewboard.reviews.errors.RevokeShipItError – The Ship It could not be revoked. Details will be in the error message.
all_participants[source]

Decorator that converts a method with a single self argument into a property cached on the instance.

get_participants()[source]

Return a list of participants in the review’s discussion.

This will always contain the user who filed the review, plus every user who has published a reply to the review, in order of the creation (but not publishing) of the reply. Users with unpublished replies are included in the list.

Deprecated since version 3.0.12: This has been replaced with the more efficient all_participants.

Returns:The users who participated in the discussion.
Return type:list of django.contrib.auth.models.User
participants[source]

Return a list of participants in the review’s discussion.

This will always contain the user who filed the review, plus every user who has published a reply to the review, in order of the creation (but not publishing) of the reply. Users with unpublished replies are included in the list.

Deprecated since version 3.0.12: This has been replaced with the more efficient all_participants.

Returns:The users who participated in the discussion.
Return type:list of django.contrib.auth.models.User
is_accessible_by(user)[source]

Returns whether the user can access this review.

is_mutable_by(user)[source]

Returns whether the user can modify this review.

__str__()[source]
is_reply()[source]

Returns whether or not this review is a reply to another review.

is_new_for_user(user, last_visited)[source]

Return whether this review is new for a user.

The review is considered new if their last visited time is older than the review’s published timestamp and the user is not the one who created the review.

Parameters:
Returns:

True if the review is new to this user. False if it’s older than the last visited time or the user created it.

Return type:

bool

public_replies()[source]

Returns a list of public replies to this review.

public_body_top_replies(user=None)[source]

Returns a list of public replies to this review’s body top.

public_body_bottom_replies(user=None)[source]

Returns a list of public replies to this review’s body bottom.

get_pending_reply(user)[source]

Returns the pending reply owned by the specified user.

save(**kwargs)[source]
publish(user=None, trivial=False, to_owner_only=False, request=None)[source]

Publishes this review.

This will make the review public and update the timestamps of all contained comments.

delete()[source]

Deletes this review.

This will enforce that all contained comments are also deleted.

get_absolute_url(**morekwargs)[source]
get_all_comments(**kwargs)[source]

Return a list of all contained comments of all types.

has_comments(only_issues=False)[source]

Return whether the review contains any comments/issues.

Parameters:only_issues (bool, optional) – Whether or not to check for comments where issue_opened is True. True to check for issues, or False to check for comments only. Defaults to False.
Returns:True if the review contains any comments/issues and False otherwise.
Return type:bool
__unicode__()[source]
body_bottom_replies[source]
body_top_replies[source]
get_extra_data_json()[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
replies[source]
set_extra_data_json(json)[source]
status_update[source]
class ReviewRequest(*args, **kwargs)[source]

Bases: reviewboard.reviews.models.base_review_request_details.BaseReviewRequestDetails

A review request.

This is one of the primary models in Review Board. Most everything is associated with a review request.

The ReviewRequest model contains detailed information on a review request. Some fields are user-modifiable, while some are used for internal state.

PENDING_REVIEW = u'P'[source]
SUBMITTED = u'S'[source]
DISCARDED = u'D'[source]
STATUSES = ((u'P', _(u'Pending Review')), (u'S', _(u'Submitted')), (u'D', _(u'Discarded')))[source]
ISSUE_COUNTER_FIELDS = {u'A': u'issue_verifying_count', u'B': u'issue_verifying_count', u'D': u'issue_dropped_count', u'O': u'issue_open_count', u'R': u'issue_resolved_count'}[source]
submitter[source]
last_updated

A descriptor for tracking the modification of a value.

field_name

unicode – The attribute name of the field on the model.

state_name

unicode – The attribute name of the state on the model.

repository[source]
diffset_history[source]
target_groups[source]
target_people[source]
screenshots[source]
inactive_screenshots[source]
file_attachments[source]
inactive_file_attachments[source]
file_attachment_histories[source]
changedescs[source]
depends_on[source]
shipit_count = <djblets.db.fields.counter_field.CounterField: shipit_count>[source]
issue_open_count = <djblets.db.fields.counter_field.CounterField: issue_open_count>[source]
issue_resolved_count = <djblets.db.fields.counter_field.CounterField: issue_resolved_count>[source]
issue_dropped_count = <djblets.db.fields.counter_field.CounterField: issue_dropped_count>[source]
issue_verifying_count = <djblets.db.fields.counter_field.CounterField: issue_verifying_count>[source]
screenshots_count = <djblets.db.fields.relation_counter_field.RelationCounterField: screenshots_count>[source]
inactive_screenshots_count = <djblets.db.fields.relation_counter_field.RelationCounterField: inactive_screenshots_count>[source]
file_attachments_count = <djblets.db.fields.relation_counter_field.RelationCounterField: file_attachments_count>[source]
inactive_file_attachments_count = <djblets.db.fields.relation_counter_field.RelationCounterField: inactive_file_attachments_count>[source]
local_site[source]
objects = <reviewboard.reviews.managers.ReviewRequestManager object>[source]
static status_to_string()[source]

Return a string representation of a review request status.

Parameters:status (unicode) – A single-character string representing the status.
Returns:A longer string representation of the status suitable for use in the API.
Return type:unicode
static string_to_status()[source]

Return a review request status from an API string.

Parameters:status (unicode) – A string from the API representing the status.
Returns:A single-character string representing the status, suitable for storage in the status field.
Return type:unicode
get_commit()[source]
set_commit(commit_id)[source]
commit[source]
approved[source]

Returns whether or not a review request is approved by reviewers.

On a default installation, a review request is approved if it has at least one Ship It!, and doesn’t have any open issues.

Extensions may customize approval by providing their own ReviewRequestApprovalHook.

approval_failure[source]

Returns the error indicating why a review request isn’t approved.

If approved is False, this will provide the text describing why it wasn’t approved.

Extensions may customize approval by providing their own ReviewRequestApprovalHook.

owner[source]

The owner of a review request.

This is an alias for submitter. It provides compatibilty with ReviewRequestDraft.owner, for functions working with either method, and for review request fields, but it cannot be used for queries.

review_participants[source]

Return the participants in reviews on the review request.

This will contain the users who published any reviews or replies on the review request. The list will be in username sort order and will not contain duplicates.

This will only contain the owner of the review request if they’ve filed a review or reply.

Returns:The users who filed reviews or replies.
Return type:set of django.contrib.auth.models.User
get_participants()[source]

Return a list of participants in a review’s discussion.

This will contain the author of the review and every user who has replied to the review, in order of the creation (but not publishing) of the reply. Users with unpublished replies are included in the list.

Deprecated since version 3.0.12: This has been replaced with the more efficient review_participants.

Returns:The users who filed reviews or replies.
Return type:list of django.contrib.auth.models.User
participants[source]

Return a list of participants in a review’s discussion.

This will contain the author of the review and every user who has replied to the review, in order of the creation (but not publishing) of the reply. Users with unpublished replies are included in the list.

Deprecated since version 3.0.12: This has been replaced with the more efficient review_participants.

Returns:The users who filed reviews or replies.
Return type:list of django.contrib.auth.models.User
get_new_reviews(user)[source]

Returns all new reviews since last viewing this review request.

This will factor in the time the user last visited the review request, and find any reviews that have been added or updated since.

get_display_id()[source]

Returns the ID that should be exposed to the user.

display_id[source]

Returns the ID that should be exposed to the user.

get_public_reviews()[source]

Returns all public top-level reviews for this review request.

is_accessible_by(user, local_site=None, request=None, silent=False)[source]

Returns whether or not the user can read this review request.

This performs several checks to ensure that the user has access. This user has access if:

  • The review request is public or the user can modify it (either by being an owner or having special permissions).
  • The repository is public or the user has access to it (either by being explicitly on the allowed users list, or by being a member of a review group on that list).
  • The user is listed as a requested reviewer or the user has access to one or more groups listed as requested reviewers (either by being a member of an invite-only group, or the group being public).
is_mutable_by(user)[source]

Returns whether the user can modify this review request.

is_status_mutable_by(user)[source]

Returns whether the user can modify this review request’s status.

is_deletable_by(user)[source]

Returns whether the user can delete this review request.

get_draft(user=None)[source]

Returns the draft of the review request.

If a user is specified, than the draft will be returned only if owned by the user. Otherwise, None will be returned.

get_pending_review(user)[source]

Returns the pending review owned by the specified user, if any.

This will return an actual review, not a reply to a review.

get_last_activity(diffsets=None, reviews=None)[source]

Returns the last public activity information on the review request.

This will return the last object updated, along with the timestamp of that object. It can be used to judge whether something on a review request has been made public more recently.

Deprecated since version 3.0: See get_last_activity_info() instead.

Parameters:
  • diffsets (list of reviewboard.diffviewer.models.DiffSet, optional) –

    The list of diffsets to compare for latest activity.

    If not provided, this will be populated with the last diffset.

  • reviews (list of reviewboard.reviews.models.Review, optional) –

    The list of reviews to compare for latest activity.

    If not provided, this will be populated with the latest review.

Returns:

Return type:

tuple

get_last_activity_info(diffsets=None, reviews=None)[source]

Return the last public activity information on the review request.

Parameters:
  • diffsets (list of reviewboard.diffviewer.models.DiffSet, optional) –

    The list of diffsets to compare for latest activity.

    If not provided, this will be populated with the last diffset.

  • reviews (list of reviewboard.reviews.models.Review, optional) –

    The list of reviews to compare for latest activity.

    If not provided, this will be populated with the latest review.

Returns:

A dictionary with the following keys:

timestamp:

The datetime that the object was updated.

updated_object:

The object that was updated. This will be one of the following:

changedesc:

The latest ChangeDescription, if any.

Return type:

dict

changeset_is_pending(commit_id)[source]

Returns whether the associated changeset is pending commit.

For repositories that support it, this will return whether the associated changeset is pending commit. This requires server-side knowledge of the change.

get_absolute_url(**morekwargs)[source]
get_diffsets()[source]

Returns a list of all diffsets on this review request.

This will also fetch all associated FileDiffs, as well as a count of the number of files (stored in DiffSet.file_count).

get_latest_diffset()[source]

Returns the latest diffset for this review request.

get_close_info()[source]

Return metadata of the most recent closing of a review request.

This is a helper which is used to gather the data which is rendered in the close description boxes on various pages.

Returns:A dictionary with the following keys:
'close_description' (unicode):
Description of review request upon closing.
'is_rich_text' (bool):
Boolean whether description is rich text.
'timestamp' (datetime.datetime):
Time of review requests last closing.
Return type:dict
get_close_description()[source]

Return metadata of the most recent closing of a review request.

This is a helper which is used to gather the data which is rendered in the close description boxes on various pages.

Deprecated since version 3.0: Use get_close_info() instead

Returns:A 2-tuple of:
  • The close description (unicode)
  • Whether or not the close description is rich text (bool)
Return type:tuple
get_blocks()[source]

Returns the list of review request this one blocks.

The returned value will be cached for future lookups.

save(update_counts=False, old_submitter=None, **kwargs)[source]
delete(**kwargs)[source]
can_publish()[source]
close(close_type=None, user=None, description=None, rich_text=False, **kwargs)[source]

Closes the review request.

Parameters:
  • close_type (unicode) – How the close occurs. This should be one of SUBMITTED or DISCARDED.
  • user (django.contrib.auth.models.User) – The user who is closing the review request.
  • description (unicode) – An optional description that indicates why the review request was closed.
  • rich_text (bool) – Indicates whether or not that the description is rich text.
Raises:
  • ValueError – The provided close type is not a valid value.
  • PermissionError – The user does not have permission to close the review request.
  • TypeError – Keyword arguments were supplied to the function.

Changed in version 3.0: The type argument is deprecated: close_type should be used instead.

This method raises ValueError instead of AttributeError when the close_type has an incorrect value.

reopen(user=None)[source]

Reopens the review request for review.

publish(user, trivial=False, validate_fields=True)[source]

Publishes the current draft attached to this review request.

The review request will be mark as public, and signals will be emitted for any listeners.

determine_user_for_changedesc(changedesc)[source]

Determine the user associated with the change description.

Parameters:changedesc (reviewboard.changedescs.models.ChangeDescription) – The change description.
Returns:The user associated with the change description.
Return type:django.contrib.auth.models.User
get_review_request()[source]

Returns this review request.

This is provided so that consumers can be passed either a ReviewRequest or a ReviewRequestDraft and retrieve the actual ReviewRequest regardless of the object.

blocks[source]
decrement_file_attachments_count(*args, **kwargs)[source]
decrement_inactive_file_attachments_count(*args, **kwargs)[source]
decrement_inactive_screenshots_count(*args, **kwargs)[source]
decrement_issue_dropped_count(*args, **kwargs)[source]
decrement_issue_open_count(*args, **kwargs)[source]
decrement_issue_resolved_count(*args, **kwargs)[source]
decrement_issue_verifying_count(*args, **kwargs)[source]
decrement_screenshots_count(*args, **kwargs)[source]
decrement_shipit_count(*args, **kwargs)[source]
draft[source]
draft_blocks[source]
get_extra_data_json()[source]
get_next_by_last_updated(**morekwargs)[source]
get_next_by_time_added(**morekwargs)[source]
get_previous_by_last_updated(**morekwargs)[source]
get_previous_by_time_added(**morekwargs)[source]
get_status_display(**morekwargs)[source]
increment_file_attachments_count(*args, **kwargs)[source]
increment_inactive_file_attachments_count(*args, **kwargs)[source]
increment_inactive_screenshots_count(*args, **kwargs)[source]
increment_issue_dropped_count(*args, **kwargs)[source]
increment_issue_open_count(*args, **kwargs)[source]
increment_issue_resolved_count(*args, **kwargs)[source]
increment_issue_verifying_count(*args, **kwargs)[source]
increment_screenshots_count(*args, **kwargs)[source]
increment_shipit_count(*args, **kwargs)[source]
reinit_file_attachments_count()[source]
reinit_inactive_file_attachments_count()[source]
reinit_inactive_screenshots_count()[source]
reinit_issue_dropped_count()[source]
reinit_issue_open_count()[source]
reinit_issue_resolved_count()[source]
reinit_issue_verifying_count()[source]
reinit_screenshots_count()[source]
reinit_shipit_count()[source]
reload_file_attachments_count()[source]
reload_inactive_file_attachments_count()[source]
reload_inactive_screenshots_count()[source]
reload_issue_dropped_count()[source]
reload_issue_open_count()[source]
reload_issue_resolved_count()[source]
reload_issue_verifying_count()[source]
reload_screenshots_count()[source]
reload_shipit_count()[source]
reviews[source]
set_extra_data_json(json)[source]
starred_by[source]
status_updates[source]
trophies[source]
visits[source]
class ReviewRequestDraft(*args, **kwargs)[source]

Bases: reviewboard.reviews.models.base_review_request_details.BaseReviewRequestDetails

A draft of a review request.

When a review request is being modified, a special draft copy of it is created containing all the details of the review request. This copy can be modified and eventually saved or discarded. When saved, the new details are copied back over to the originating ReviewRequest.

owner[source]
review_request[source]
last_updated

A descriptor for tracking the modification of a value.

field_name

unicode – The attribute name of the field on the model.

state_name

unicode – The attribute name of the state on the model.

diffset[source]
changedesc[source]
target_groups[source]
target_people[source]
screenshots[source]
inactive_screenshots[source]
file_attachments[source]
inactive_file_attachments[source]
submitter[source]
repository[source]
local_site[source]
depends_on[source]
screenshots_count = <djblets.db.fields.relation_counter_field.RelationCounterField: screenshots_count>[source]
inactive_screenshots_count = <djblets.db.fields.relation_counter_field.RelationCounterField: inactive_screenshots_count>[source]
file_attachments_count = <djblets.db.fields.relation_counter_field.RelationCounterField: file_attachments_count>[source]
inactive_file_attachments_count = <djblets.db.fields.relation_counter_field.RelationCounterField: inactive_file_attachments_count>[source]
objects = <djblets.db.managers.ConcurrencyManager object>[source]
commit[source]
get_latest_diffset()[source]

Returns the diffset for this draft.

is_accessible_by(user)[source]

Returns whether or not the user can access this draft.

is_mutable_by(user)[source]

Returns whether or not the user can modify this draft.

static create(changedesc=None)[source]

Create a draft based on a review request.

This will copy over all the details of the review request that we care about. If a draft already exists for the review request, the draft will be returned.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request to fetch or create the draft from.
  • changedesc (reviewboard.changedescs.models.ChangeDescription) – A custom change description to set on the draft. This will always be set, overriding any previous one if already set.
Returns:

The resulting draft.

Return type:

ReviewRequestDraft

publish(review_request=None, user=None, trivial=False, send_notification=True, validate_fields=True, timestamp=None)[source]

Publish this draft.

This is an internal method. Programmatic publishes should use reviewboard.reviews.models.review_request.ReviewRequest.publish() instead.

This updates and returns the draft’s ChangeDescription, which contains the changed fields. This is used by the e-mail template to tell people what’s new and interesting.

The keys that may be saved in fields_changed in the ChangeDescription are:

  • submitter
  • summary
  • description
  • testing_done
  • bugs_closed
  • depends_on
  • branch
  • target_groups
  • target_people
  • screenshots
  • screenshot_captions
  • diff
  • Any custom field IDs

Each field in ‘fields_changed’ represents a changed field. This will save fields in the standard formats as defined by the ‘ChangeDescription’ documentation, with the exception of the ‘screenshot_captions’ and ‘diff’ fields.

For the ‘screenshot_captions’ field, the value will be a dictionary of screenshot ID/dict pairs with the following fields:

  • old: The old value of the field
  • new: The new value of the field

For the diff field, there is only ever an added field, containing the ID of the new diffset.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest, optional) – The review request associated with this diff. If not provided, it will be looked up.
  • user (django.contrib.auth.models.User, optional) – The user publishing the draft. If not provided, this defaults to the review request submitter.
  • trivial (bool, optional) –

    Whether or not this is a trivial publish.

    Trivial publishes do not result in e-mail notifications.

  • send_notification (bool, optional) –

    Whether or not this will emit the reviewboard.reviews.signals.review_request_published signal.

    This parameter is intended for internal use only.

  • validate_fields (bool, optional) –

    Whether or not the fields should be validated.

    This should only be False in the case of programmatic publishes, e.g., from close as submitted hooks.

  • timestamp (datetime.datetime, optional) – The datetime that should be used for all timestamps for objects published (DiffSet, ChangeDescription) over the course of the method.
Returns:

The change description that results from this publish (if any).

If this is an initial publish, there will be no change description (and this function will return None).

Return type:

reviewboard.changedescs.models.ChangeDescription

update_from_commit_id(commit_id)[source]

Update the data from a server-side changeset.

If the commit ID refers to a pending changeset on an SCM which stores such things server-side (like Perforce), the details like the summary and description will be updated with the latest information.

If the change number is the commit ID of a change which exists on the server, the summary and description will be set from the commit’s message, and the diff will be fetched from the SCM.

Parameters:commit_id (unicode) – The commit ID or changeset ID that the draft will update from.
Returns:The list of draft fields that have been updated from the commit.
Return type:list of unicode
update_from_pending_change(commit_id, changeset)[source]

Update the data from a server-side pending changeset.

This will fetch the metadata from the server and update the fields on the draft.

Parameters:
Returns:

The list of draft fields that have been updated from the change.

Return type:

list of unicode

update_from_committed_change(commit_id)[source]

Update from a committed change present on the server.

Fetches the commit message and diff from the repository and sets the relevant fields.

Parameters:commit_id (unicode) – The commit ID to update from.
Returns:The list of draft fields that have been updated from the commit message.
Return type:list of unicode
copy_fields_to_request(review_request)[source]

Copies the draft information to the review request and updates the draft’s change description.

get_review_request()[source]

Returns the associated review request.

decrement_file_attachments_count(*args, **kwargs)[source]
decrement_inactive_file_attachments_count(*args, **kwargs)[source]
decrement_inactive_screenshots_count(*args, **kwargs)[source]
decrement_screenshots_count(*args, **kwargs)[source]
get_extra_data_json()[source]
get_next_by_last_updated(**morekwargs)[source]
get_previous_by_last_updated(**morekwargs)[source]
increment_file_attachments_count(*args, **kwargs)[source]
increment_inactive_file_attachments_count(*args, **kwargs)[source]
increment_inactive_screenshots_count(*args, **kwargs)[source]
increment_screenshots_count(*args, **kwargs)[source]
reinit_file_attachments_count()[source]
reinit_inactive_file_attachments_count()[source]
reinit_inactive_screenshots_count()[source]
reinit_screenshots_count()[source]
reload_file_attachments_count()[source]
reload_inactive_file_attachments_count()[source]
reload_inactive_screenshots_count()[source]
reload_screenshots_count()[source]
set_extra_data_json(json)[source]
class Screenshot(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A screenshot associated with a review request.

Like diffs, a screenshot can have comments associated with it. These comments are of type reviewboard.reviews.models.ScreenshotComment.

image

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

filename[source]

Returns the filename for display purposes.

get_comments()[source]

Returns all the comments made on this screenshot.

get_thumbnail_url()[source]

Returns the URL for the thumbnail, creating it if necessary.

thumb()[source]

Creates and returns HTML for this screenshot’s thumbnail.

__str__()[source]
get_review_request()[source]
get_absolute_url(**morekwargs)[source]
save(**kwargs)[source]
__unicode__()[source]
comments[source]
drafts[source]
inactive_drafts[source]
inactive_review_request[source]
objects = <django.db.models.manager.Manager object>[source]
review_request[source]
class ScreenshotComment(*args, **kwargs)[source]

Bases: reviewboard.reviews.models.base_comment.BaseComment

A comment on a screenshot.

anchor_prefix = u'scomment'[source]
comment_type = u'screenshot'[source]
screenshot[source]
get_image_url()[source]

Returns the URL for the thumbnail, creating it if necessary.

image()[source]

Returns HTML for a section of the screenshot for this comment.

This will generate the cropped part of the screenshot referenced by this comment and returns the HTML markup embedding it.

get_extra_data_json()[source]
get_issue_status_display(**morekwargs)[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
objects = <djblets.db.managers.ConcurrencyManager object>[source]
replies[source]
reply_to[source]
review[source]
set_extra_data_json(json)[source]
class StatusUpdate(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A status update from a third-party service or extension.

This status model allows external services (such as continuous integration services, Review Bot, etc.) to provide an update on their status. An example of this would be a CI tool which does experimental builds of changes. While the build is running, that tool would set its status to pending, and when it was done, would set it to one of the done states, and potentially associate it with a review containing issues.

PENDING = u'P'[source]

The pending state.

DONE_SUCCESS = u'S'[source]

The completed successfully state.

DONE_FAILURE = u'F'[source]

The completed with reported failures state.

ERROR = u'E'[source]

The error state.

TIMEOUT = u'T'[source]

Timeout state.

STATUSES = ((u'P', _(u'Pending')), (u'S', _(u'Done (Success)')), (u'F', _(u'Done (Failure)')), (u'E', _(u'Error')), (u'T', _(u'Timed Out')))[source]
service_id = None

An identifier for the service posting this status update.

This ID is self-assigned, and just needs to be unique to that service. Possible values can be an extension ID, webhook URL, or a script name.

user[source]

The user who created this status update.

timestamp = None

The timestamp of the status update.

summary = None

A user-visible short summary of the status update.

This is typically the name of the integration or tool that was run.

description = None

A user-visible description on the status update.

This is shown in the UI adjacent to the summary. Typical results might be things like “running.” or “failed.”. This should include punctuation.

url = None

An optional link.

This is used in case the tool has some external page, such as a build results page on a CI system.

url_text = None

Text for the link. If url is empty, this will not be used.

state = None

The current state of this status update.

This should be set to PENDING while the service is processing the update, and then to either DONE_SUCCESS or DONE_FAILURE once complete. If the service encountered some error which prevented completion, this should be set to ERROR.

review_request[source]

The review request that this status update is for.

change_description[source]

The change to the review request that this status update is for.

If this is None, this status update refers to the review request as a whole (for example, the initial diff that was posted).

review[source]

An optional review created for this status update.

This allows the third-party service to create comments and open issues.

extra_data = None

Any extra data that the service wants to store for this status update.

timeout = None

An (optional) timeout, in seconds. If this is non-None and the state has been PENDING for longer than this period (computed from the timestamp field), effective_state will be TIMEOUT.

static state_to_string()[source]

Return a string representation of a status update state.

Parameters:state (unicode) – A single-character string representing the state.
Returns:A longer string representation of the state suitable for use in the API.
Return type:unicode
static string_to_state()[source]

Return a status update state from an API string.

Parameters:state (unicode) – A string from the API representing the state.
Returns:A single-character string representing the state, suitable for storage in the state field.
Return type:unicode
is_mutable_by(user)[source]

Return whether the user can modify this status update.

Parameters:user (django.contrib.auth.models.User) – The user to check.
Returns:True if the user can modify this status update.
Return type:bool
effective_state[source]

The state of the status update, taking into account timeouts.

get_extra_data_json()[source]
get_next_by_timestamp(**morekwargs)[source]
get_previous_by_timestamp(**morekwargs)[source]
get_state_display(**morekwargs)[source]
objects = <django.db.models.manager.Manager object>[source]
set_extra_data_json(json)[source]