l.b.m.b.Bug(SQLBase, InformationTypeMixin) : class documentation

Part of lp.bugs.model.bug View In Hierarchy

A bug.
Method linked_branches Undocumented
Method cves Undocumented
Method questions Undocumented
Method specifications Undocumented
Method getSpecifications See IBug.
Method security_related Undocumented
Method latest_patch See IBug.
Method comment_count See IBug.
Method users_affected See IBug.
Method users_unaffected See IBug.
Method user_ids_affected_with_dupes Return all IDs of Persons affected by this bug and its dupes.
Method users_affected_with_dupes See IBug.
Method users_affected_count_with_dupes See IBug.
Method other_users_affected_count_with_dupes See IBug.
Method indexed_messages See IMessageTarget.
Method displayname See IBug.
Method bugtasks See IBug.
Method default_bugtask See IBug.
Method is_complete See IBug.
Method affected_pillars See IBug.
Method permits_expiration See IBug.
Method can_expire See IBug.
Method isExpirable See IBug.
Method initial_message See IBug.
Method official_tags See IBug.
Method followup_subject See IBug.
Method has_patches See IBug.
Method subscribe See IBug.
Method unsubscribe See IBug.
Method unsubscribeFromDupes See IBug.
Method isSubscribed See IBug.
Method isSubscribedToDupes See IBug.
Method isMuted See IBug.
Method mute See IBug.
Method unmute See IBug.
Method subscriptions The set of BugSubscriptions for this bug.
Method getSubscriptionInfo See IBug.
Method getDirectSubscriptions See IBug.
Method getDirectSubscribers See IBug.
Method getDirectSubscribersWithDetails See IBug.
Method getIndirectSubscribers See IBug.
Method getSubscriptionsFromDuplicates See IBug.
Method getSubscribersFromDuplicates See IBug.
Method getSubscribersForPerson See `IBug.
Method getSubscriptionForPerson See IBug.
Method getAlsoNotifiedSubscribers See IBug.
Method getBugNotificationRecipients See IBug.
Method clearBugNotificationRecipientsCache Undocumented
Method addCommentNotification See IBug.
Method addChange See IBug.
Method expireNotifications See IBug.
Method newMessage Create a new Message and link it to this bug.
Method linkMessage See IBug.
Method addTask See IBug.
Method addWatch See IBug.
Method removeWatch See IBug.
Method addAttachment See IBug.
Method linkAttachment See IBug.
Method linkBranch See IBug.
Method unlinkBranch See IBug.
Method getVisibleLinkedBranches See IBug.
Method linkMergeProposal See IBug.
Method unlinkMergeProposal See IBug.
Method linked_merge_proposals Undocumented
Method getVisibleLinkedMergeProposals See IBug.
Method has_cves See IBug.
Method linkCVE See IBug.
Method unlinkCVE See IBug.
Method findCvesInText See IBug.
Method canBeAQuestion See IBug.
Method convertToQuestion See IBug.
Method getQuestionCreatedFromBug See IBug.
Method getMessagesForView See IBug.
Method addNomination See IBug.
Method canBeNominatedFor See IBug.
Method getNominationFor See IBug.
Method getNominations See IBug.
Method getBugWatch See IBug.
Method setStatus See IBug.
Method setPrivate See IBug.
Method setSecurityRelated Setter for the security_related property.
Method getAllowedInformationTypes See IBug.
Method transitionToInformationType See IBug.
Method getBugTask See IBug.
Static Method getBugTasksByPackageName See IBugTask.
Method isUserAffected See IBug.
Method shouldConfirmBugtasks See IBug.
Method maybeConfirmBugtasks See IBug.
Method markUserAffected See IBug.
Method markAsDuplicate See IBug.
Method setCommentVisibility See IBug.
Method userCanView See IBug.
Method userCanSetCommentVisibility See IBug
Method linkHWSubmission See IBug.
Method unlinkHWSubmission See IBug.
Method getHWSubmissions See IBug.
Method personIsDirectSubscriber See IBug.
Method personIsAlsoNotifiedSubscriber See IBug.
Method personIsSubscribedToDuplicate See IBug.
Method attachments See IBug.
Method attachments_unpopulated See IBug.
Method getActivityForDateRange See IBug.
Method _subscriber_cache Caches known subscribers.
Method _subscriber_dups_cache Caches known subscribers to dupes.
Method _unsubscribed_cache Cache known non-subscribers.
Method _indexed_messages Get the bugs messages, indexed.
Method _getMutes Undocumented
Method _getBugNotificationRecipients Get the recipients for the BugNotificationLevel.
Method _notification_recipients_for_lifecycle The cached BugNotificationRecipients for LIFECYCLE events.
Method _notification_recipients_for_metadata The cached BugNotificationRecipients for METADATA events.
Method _notification_recipients_for_comments The cached BugNotificationRecipients for COMMENT events.
Method _getQuestionTargetableBugTask Return the only bugtask that can be a QuestionTarget, or None.
Method _question_from_bug Undocumented
Method _getTags Get the tags as a sorted list of strings.
Method _cached_tags Undocumented
Method _setTags Set the tags from a list of strings.
Method _getAffectedUser Return the IBugAffectsPerson for a user, or None
Method _flushAndInvalidate Flush all changes to the store and re-read self from the DB.
Method _markAsDuplicate Mark this bug as a duplicate of another.
Method _known_viewers A set of known persons able to view this bug.
Method _reconcileAccess Undocumented
Method _attachments_query Helper for the attachments* properties.

Inherited from SQLBase:

Method __init__ Extended version of the SQLObjectBase constructor.
Method __repr__ Undocumented
Method destroySelf Undocumented
Method __eq__ Equality operator.
Method __ne__ Inverse of __eq__.
Method __storm_invalidated__ Flush cached properties.
Class Method _get_store Undocumented

Inherited from InformationTypeMixin:

Method private Undocumented
@property
def linked_branches(self):
Undocumented
@property
def cves(self):
Undocumented
@property
def questions(self):
Undocumented
@property
def specifications(self):
Undocumented
def getSpecifications(self, user):
See IBug.
@property
def security_related(self):
Undocumented
@cachedproperty
def _subscriber_cache(self):
Caches known subscribers.
@cachedproperty
def _subscriber_dups_cache(self):
Caches known subscribers to dupes.
@cachedproperty
def _unsubscribed_cache(self):
Cache known non-subscribers.
@property
def latest_patch(self):
See IBug.
@property
def comment_count(self):
See IBug.
@property
def users_affected(self):
See IBug.
@property
def users_unaffected(self):
See IBug.
@property
def user_ids_affected_with_dupes(self):
Return all IDs of Persons affected by this bug and its dupes. The return value is a Storm expression. Running a query with this expression returns a result that may contain the same ID multiple times, for example if that person is affected via more than one duplicate.
@property
def users_affected_with_dupes(self):
See IBug.
@property
def users_affected_count_with_dupes(self):
See IBug.
@property
def other_users_affected_count_with_dupes(self):
See IBug.
@property
def indexed_messages(self):
See IMessageTarget.
def _indexed_messages(self, include_content=False, include_parents=True):
Get the bugs messages, indexed.
Parametersinclude_contentIf True retrieve the content for the messages too.
include_parentsIf True retrieve the object for parent messages too. If False the parent attribute will be forced to None to reduce database lookups.
@property
def displayname(self):
See IBug.
@cachedproperty
def bugtasks(self):
See IBug.
@property
def default_bugtask(self):
See IBug.
@property
def is_complete(self):
See IBug.
@property
def affected_pillars(self):
See IBug.
@property
def permits_expiration(self):
See IBug.

This property checks the general state of the bug to determine if expiration is permitted if a bugtask were to qualify for expiration. This property does not check the bugtask preconditions to identify a specific bugtask that can expire.

See AlsoIBug.can_expire or BugTaskSet.findExpirableBugTasks to check or get a list of bugs that can expire.
@property
def can_expire(self):

See IBug.

Only Incomplete bug reports that affect a single pillar with enabled_bug_expiration set to True can be expired. To qualify for expiration, the bug and its bugtasks meet the follow conditions:

  1. The bug is inactive; the last update of the bug is older than

    Launchpad expiration age.

  2. The bug is not a duplicate.

  3. The bug has at least one message (a request for more information).

  4. The bug does not have any other valid bugtasks.

  5. The bugtask belongs to a project with enable_bug_expiration set to True.

  6. The bugtask has the status Incomplete.

  7. The bugtask is not assigned to anyone.

  8. The bugtask does not have a milestone.

def isExpirable(self, days_old=None):
See IBug.
@cachedproperty
def initial_message(self):
See IBug.
@cachedproperty
def official_tags(self):
See IBug.
def followup_subject(self):
See IBug.
@property
def has_patches(self):
See IBug.
def subscribe(self, person, subscribed_by, suppress_notify=True, level=None):
See IBug.
def unsubscribe(self, person, unsubscribed_by, **kwargs):
See IBug.
def unsubscribeFromDupes(self, person, unsubscribed_by):
See IBug.
def isSubscribed(self, person):
See IBug.
def isSubscribedToDupes(self, person):
See IBug.
def _getMutes(self, person):
Undocumented
def isMuted(self, person):
See IBug.
def mute(self, person, muted_by):
See IBug.
def unmute(self, person, unmuted_by):
See IBug.
@property
def subscriptions(self):
The set of BugSubscriptions for this bug.
def getSubscriptionInfo(self, level=None):
See IBug.
def getDirectSubscriptions(self):
See IBug.
def getDirectSubscribers(self, recipients=None, level=None, filter_visible=False):
See IBug.

The recipients argument is private and not exposed in the interface. If a BugNotificationRecipients instance is supplied, the relevant subscribers and rationales will be registered on it.

def getDirectSubscribersWithDetails(self):
See IBug.
def getIndirectSubscribers(self, recipients=None, level=None):
See IBug.

See the comment in getDirectSubscribers for a description of the recipients argument.

def getSubscriptionsFromDuplicates(self, recipients=None):
See IBug.
def getSubscribersFromDuplicates(self, recipients=None, level=None):
See IBug.

See the comment in getDirectSubscribers for a description of the recipients argument.

def getSubscribersForPerson(self, person):
See `IBug.
def getSubscriptionForPerson(self, person):
See IBug.
def getAlsoNotifiedSubscribers(self, recipients=None, level=None):
See IBug.

See the comment in getDirectSubscribers for a description of the recipients argument.

def _getBugNotificationRecipients(self, level):
Get the recipients for the BugNotificationLevel.
@cachedproperty
def _notification_recipients_for_lifecycle(self):
The cached BugNotificationRecipients for LIFECYCLE events.
@cachedproperty
def _notification_recipients_for_metadata(self):
The cached BugNotificationRecipients for METADATA events.
@cachedproperty
def _notification_recipients_for_comments(self):
The cached BugNotificationRecipients for COMMENT events.
def getBugNotificationRecipients(self, level=BugNotificationLevel.LIFECYCLE):
See IBug.
def clearBugNotificationRecipientsCache(self):
Undocumented
def addCommentNotification(self, message, recipients=None, activity=None, level=BugNotificationLevel.COMMENTS):
See IBug.
def addChange(self, change, recipients=None, deferred=False, update_heat=True):
See IBug.
def expireNotifications(self):
See IBug.
def newMessage(self, owner=None, subject=None, content=None, parent=None, bugwatch=None, remote_comment_id=None, send_notifications=True):
Create a new Message and link it to this bug.
def linkMessage(self, message, bugwatch=None, user=None, remote_comment_id=None):
See IBug.
def addTask(self, owner, target, validate_target=True):
See IBug.
def addWatch(self, bugtracker, remotebug, owner):
See IBug.
def removeWatch(self, bug_watch, user):
See IBug.
def addAttachment(self, owner, data, comment, filename, is_patch=False, content_type=None, description=None, from_api=False):
See IBug.
def linkAttachment(self, owner, file_alias, comment, is_patch=False, description=None, send_notifications=True):
See IBug.

This method should only be called by addAttachment() and FileBugViewBase.submit_bug_action, otherwise we may get inconsistent settings of bug.private and file_alias.restricted.

Parameterssend_notificationsControl sending of notifications for this attachment. This is disabled when adding attachments from 'extra data' in the filebug form, because that triggered hundreds of DB inserts and thus timeouts. Defaults to sending notifications.
def linkBranch(self, branch, registrant):
See IBug.
def unlinkBranch(self, branch, user):
See IBug.
def getVisibleLinkedBranches(self, user, eager_load=False):
See IBug.
def linkMergeProposal(self, merge_proposal, user, check_permissions=True):
See IBug.
def unlinkMergeProposal(self, merge_proposal, user, check_permissions=True):
See IBug.
@property
def linked_merge_proposals(self):
Undocumented
def getVisibleLinkedMergeProposals(self, user, eager_load=False):
See IBug.
@cachedproperty
def has_cves(self):
See IBug.
def linkCVE(self, cve, user, check_permissions=True):
See IBug.
def unlinkCVE(self, cve, user, check_permissions=True):
See IBug.
def findCvesInText(self, text, user):
See IBug.
def canBeAQuestion(self):
See IBug.
def _getQuestionTargetableBugTask(self):
Return the only bugtask that can be a QuestionTarget, or None.

Bugs that are also in external bug trackers cannot be converted to questions. This is also true for bugs that are being developed. None is returned when either of these conditions are true.

The bugtask is selected by these rules: 1. It's status is not Invalid. 2. It is not a conjoined slave. Only one bugtask must meet both conditions to be return. When zero or many bugtasks match, None is returned.

def convertToQuestion(self, person, comment=None):
See IBug.
@cachedproperty
def _question_from_bug(self):
Undocumented
def getQuestionCreatedFromBug(self):
See IBug.
def getMessagesForView(self, slice_info):
See IBug.
def addNomination(self, owner, target):
See IBug.
def canBeNominatedFor(self, target):
See IBug.
def getNominationFor(self, target):
See IBug.
def getNominations(self, target=None, nominations=None):
See IBug.
def getBugWatch(self, bugtracker, remote_bug):
See IBug.
def setStatus(self, target, status, user):
See IBug.
def setPrivate(self, private, who):
See IBug.

We also record who made the change and when the change took place.

def setSecurityRelated(self, security_related, who):
Setter for the security_related property.
def getAllowedInformationTypes(self, who):
See IBug.
def transitionToInformationType(self, information_type, who):
See IBug.
def getBugTask(self, target):
See IBug.
def _getTags(self):
Get the tags as a sorted list of strings.
@cachedproperty
def _cached_tags(self):
Undocumented
def _setTags(self, tags):
Set the tags from a list of strings.
@staticmethod
def getBugTasksByPackageName(bugtasks):
See IBugTask.
def _getAffectedUser(self, user):
Return the IBugAffectsPerson for a user, or None
ParametersuserAn IPerson that may be affected by the bug.
ReturnsAn IBugAffectsPerson or None.
def isUserAffected(self, user):
See IBug.
def _flushAndInvalidate(self):
Flush all changes to the store and re-read self from the DB.
def shouldConfirmBugtasks(self):
See IBug.
def maybeConfirmBugtasks(self):
See IBug.
def markUserAffected(self, user, affected=True):
See IBug.
def _markAsDuplicate(self, duplicate_of, affected_bug_ids):
Mark this bug as a duplicate of another.

Marking a bug as a duplicate requires a recalculation of the heat of this bug and of the master bug. None of this is done here in order to avoid unnecessary repetitions in recursive calls for duplicates of this bug, which also become duplicates of the new master bug.

def markAsDuplicate(self, duplicate_of):
See IBug.
def setCommentVisibility(self, user, comment_number, visible):
See IBug.
@cachedproperty
def _known_viewers(self):
A set of known persons able to view this bug.

This method must return an empty set or bug searches will trigger late evaluation. Any 'should be set on load' properties must be done by the bug search.

If you are tempted to change this method, don't. Instead see userCanView which defines the just-in-time policy for bug visibility, and BugTask._search which honours visibility rules.

def userCanView(self, user):
See IBug.

This method is called by security adapters but only in the case for authenticated users. It is also called in other contexts where the user may be anonymous.

Most logic is delegated to the query provided by get_bug_privacy_filter, but some short-circuits and caching are reimplemented here.

If bug privacy rights are changed here, corresponding changes need to be made to the queries which screen for privacy. See bugtasksearch's get_bug_privacy_filter.

def userCanSetCommentVisibility(self, user):
See IBug
def linkHWSubmission(self, submission):
See IBug.
def unlinkHWSubmission(self, submission):
See IBug.
def getHWSubmissions(self, user=None):
See IBug.
def personIsDirectSubscriber(self, person):
See IBug.
def personIsAlsoNotifiedSubscriber(self, person):
See IBug.
def personIsSubscribedToDuplicate(self, person):
See IBug.
def _reconcileAccess(self):
Undocumented
def _attachments_query(self):
Helper for the attachments* properties.
@property
def attachments(self):
See IBug.

This property does eager loading of the index_messages so that the API which wants the message_link for the attachment can answer that without O(N^2) overhead. As such it is moderately expensive to call (it currently retrieves all messages before any attachments, and does this when attachments is evaluated, not when the resultset is processed).

@property
def attachments_unpopulated(self):
See IBug.

This version does not pre-lookup messages and LibraryFileAliases.

The regular 'attachments' property does prepopulation because it is exposed in the API.

def getActivityForDateRange(self, start_date, end_date):
See IBug.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.