def getRemoteStatus(self, bug_id): if not bug_id.isdigit(): raise InvalidBugId("Mantis (%s) bug number not an integer: %s" % (self.baseurl, bug_id)) try: bug = self.bugs[int(bug_id)] except KeyError: raise BugNotFound(bug_id) # Use a colon and a space to join status and resolution because # there is a chance that statuses contain spaces, and because # it makes display of the data nicer. return "%(status)s: %(resolution)s" % bug
def _findBug(self, bug_id): if not bug_id.isdigit(): raise InvalidBugId("Debbugs bug number not an integer: %s" % bug_id) try: debian_bug = self.debbugs_db[int(bug_id)] except KeyError: # If we couldn't find it in the main database, there's # always the archive. try: debian_bug = self.debbugs_db_archive[int(bug_id)] except KeyError: raise BugNotFound(bug_id) return debian_bug
def getRemoteStatus(self, bug_id): """Return the remote status of a given bug. See `ExternalBugTracker`. """ try: bug_id = int(bug_id) except ValueError: raise InvalidBugId( "RequestTracker bug ids must be integers (was passed %r)" % bug_id) if bug_id not in self.bugs: raise BugNotFound(bug_id) return self.bugs[bug_id]['status']
def _getBug(self, bug_id): """Return the bug with the ID bug_id from the internal bug list. :param bug_id: The ID of the remote bug to return. :type bug_id: int BugNotFound will be raised if the bug does not exist. InvalidBugId will be raised if bug_id is not of a valid format. """ try: bug_id = int(bug_id) except ValueError: raise InvalidBugId("bug_id must be an integer: %s." % str(bug_id)) try: return self.bugs[bug_id] except KeyError: raise BugNotFound(bug_id)
def getRemoteStatus(self, bug_id): """See `ExternalBugTracker`.""" try: bug_id = int(bug_id) except ValueError: raise InvalidBugId("bug_id must be convertible to an integer: %s" % str(bug_id)) try: remote_bug = self.bugs[bug_id] except KeyError: raise BugNotFound(bug_id) # If the remote bug is private, raise a PrivateRemoteBug error. if remote_bug['private']: raise PrivateRemoteBug("Bug %i on %s is private." % (bug_id, self.baseurl)) try: return '%(status)s:%(resolution)s' % remote_bug except KeyError: raise UnparsableBugData("Remote bug %i does not define a status." % bug_id)
def getRemoteProduct(self, remote_bug): """Return the remote product for a given bug. :return: A tuple of (group_id, atid) for the remote bug. """ try: remote_bug = int(remote_bug) except ValueError: raise InvalidBugId( "remote_bug must be convertible to an integer: %s" % str(remote_bug)) try: remote_bug = self.bugs[remote_bug] except KeyError: raise BugNotFound(remote_bug) group_id = remote_bug['group_id'] atid = remote_bug['atid'] if group_id is None or atid is None: return None else: return "%s&%s" % (group_id, atid)