Only remote task is picked

Bug #137278 reported by Cesare Tirabassi
2
Affects Status Importance Assigned to Milestone
python-launchpad-bugs
Fix Released
Undecided
Unassigned

Bug Description

Just checking with this simple script:

#!/usr/bin/python

import launchpadbugs.connector as Connector

import os

def main():

    BugList = Connector.ConnectBugList()
    for bug in BugList("https://bugs.launchpad.net/~ubuntu-universe-sponsors"):
 print bug.bugnumber, bug.sourcepackage

if __name__ == "__main__":
    main()

for a page with (amongst others) these two bugs:

                                           Summary In Importance Status
(unknown) 131325 Gutsy uses old version of conky. conky (Debian) Unknown New
(wishlist) 131325 Gutsy uses old version of conky. conky (Ubuntu) Wishlist Fix Committed

Only the Debian bug is picked (see attached output).

Revision history for this message
Cesare Tirabassi (norsetto) wrote :
Revision history for this message
Daniel Holbach (dholbach) wrote :

Effectively BugList represents every unique bug. So the data structure of a set() makes perfect sense. Right now using BugInfo will represent the different tasks. I agree that this is somewhat irksome and requires to not only download the buglist, but also the bug.

To fix this bug, I propose to add an attribute to bugs in the buglist named .affects -- using it in pseudo-code could look like this:

for b in buglist: if 'Ubuntu' in b.affects: ...

Revision history for this message
Markus Korn (thekorn) wrote :

I think Daniel's suggestion has been implemented by adding bug.has_target() (Bug 137434)

But I think the real problem is that Cesare wants to have a list of all Tasks and BugList currently returns a list of all Bugs, having a list of all tasks is useful in many cases.

I propose to add an additional (optional) argument 'all_tasks' to BugList:
 * BugList("https://bugs.launchpad.net/~ubuntu-universe-sponsors", all_tasks=True) would return list as expected by Cesare
 * BugList("https://bugs.launchpad.net/~ubuntu-universe-sponsors") would return the current state

We could also wrap around this 'all_tasks'-thing by adding a 'TaskList'-function:
TaskList("https://bugs.launchpad.net/~ubuntu-universe-sponsors") == BugList("https://bugs.launchpad.net/~ubuntu-universe-sponsors", all_tasks=True)

Markus

Revision history for this message
Markus Korn (thekorn) wrote :

This patch against py-lp-bugs.main r61 adds a TaskList object.

Example:

=== CODE ===
import launchpadbugs.connector as Connector

BugList = Connector.ConnectBugList()
TaskList = Connector.ConnectTaskList()
BugList.authentication="cookies.txt"
TaskList.authentication="cookies.txt"
bl = BugList("https://bugs.edge.launchpad.net/bughelper/+bugs")
bl += BugList("https://bugs.edge.launchpad.net/ubuntu/+source/bughelper/+bugs")
print "len BUGLIST:", len(bl.bugs)
for i in bl.sort("nr"):
    print i

bl = TaskList("https://bugs.edge.launchpad.net/bughelper/+bugs")
bl += TaskList("https://bugs.edge.launchpad.net/ubuntu/+source/bughelper/+bugs")
print "len TASKLIST:",len(bl.bugs)
for i in bl.sort("nr"):
    print i

=== RESULT ===

markus@thekorn:/home/devel/python-launchpad-bugs/main$ python error.py
len BUGLIST: 11
[Bug 81291 : Confirmed/Wishlist]
[Bug 84723 : Confirmed/Wishlist]
[Bug 88102 : Confirmed/Medium]
[Bug 88521 : Confirmed/Wishlist]
[...]
len TASKLIST: 12
[Bug 81291 : Confirmed/Wishlist]
[Bug 84723 : Confirmed/Wishlist]
[Bug 88102 : Confirmed/Undecided]
[Bug 88102 : Confirmed/Medium]
[Bug 88521 : Confirmed/Wishlist]
[...]

Markus Korn (thekorn)
Changed in python-launchpad-bugs:
status: New → Fix Committed
Revision history for this message
Markus Korn (thekorn) wrote :

python-launchpad-bugs (0.2.22) gutsy; urgency=low

  * connector.py: added TaskList() wrapper-function
  * html_buglist.py: added optional switch 'all_bugs' to BugList, BugPage
    and BugInfo; if 'all_bugs'==False BugInfo-objects are equal if
    they have the same bug-number otherwise BugInfo-objects
    are equal if all attributes are equal.

 -- Markus Korn <email address hidden> Mon, 08 Oct 2007 15:26:32 +0200

Changed in python-launchpad-bugs:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.