URLBugListFilter missing milestones

Bug #200457 reported by Brian Murray on 2008-03-10
Affects Status Importance Assigned to Milestone
Markus Korn

Bug Description

1) main revno 75

The OPTION_DICT in launchpadbugs/basebuglistfilter.py does not contain any information about milestones. It looks like "field.milestone:list" is the right bit to use. However, the milestones are checkboxes with number values and change regularly i.e. when there is a new development release.

It'd be best if the milestone lists were pulled from somewhere - probably https://launchpad.net/ubuntu/+milestones - and only active milestones were used since that is what launchpad allows you to search on.

Markus Korn (thekorn) wrote :

The attached patch adds a function 'get_open_milestones(dist=None, package=None, project=None)' as a first step to fix this bug. This function returns an iterator over all open milestones related to given distribution, package or project:

example usage:
In [7]: dict(get_open_milestones("ubuntu"))
{135: 'Ubuntu: dapper-updates',
 196: 'Ubuntu: later',
 197: 'Ubuntu: edgy-updates',
 556: 'Ubuntu: ubuntu-6.06.2',
 814: 'Ubuntu: gutsy-updates',
 829: 'Ubuntu: ubuntu-8.04',
 831: 'Ubuntu: hardy-alpha-1',
 948: 'Ubuntu: hardy-alpha-2',
 949: 'Ubuntu: hardy-alpha-3',
 950: 'Ubuntu: hardy-alpha-4',
 951: 'Ubuntu: hardy-alpha-5',
 952: 'Ubuntu: hardy-alpha-6',
 953: 'Ubuntu: ubuntu-8.04-beta'}

In [4]: dict(get_open_milestones(project="bughelper"))
Out[4]: {249: 'Bug Helper: 0.1' , 259: 'Bug Helper: 0.2'}


Changed in python-launchpad-bugs:
assignee: nobody → thekorn
status: New → In Progress
Markus Korn (thekorn) wrote :

I changed the behaviour of get_open_milestones. If you run dict(get_open_milestones(<args>)) you will now get a dict with the identifier as key and the id as value. It also contains a short-form of the identifier:

In [4]: from launchpadbugs.utils import get_open_milestones

In [5]: from launchpadbugs.basebuglistfilter import URLBugListFilter

In [6]: milestones = dict(get_open_milestones("ubuntu"))

In [7]: milestones
{'Ubuntu: dapper-updates': 135,
 'Ubuntu: edgy-updates': 197,
 'Ubuntu: gutsy-updates': 814,
 'Ubuntu: intrepid-alpha-1': 1319,
 'Ubuntu: intrepid-alpha-2': 1320,
 'Ubuntu: intrepid-alpha-3': 1321,
 'Ubuntu: intrepid-alpha-4': 1322,
 'Ubuntu: intrepid-alpha-5': 1323,
 'Ubuntu: intrepid-alpha-6': 1324,
 'Ubuntu: later': 196,
 'Ubuntu: ubuntu-8.04.1': 1264,
 'Ubuntu: ubuntu-8.04.2': 1425,
 'Ubuntu: ubuntu-8.10': 1326,
 'Ubuntu: ubuntu-8.10-beta': 1325,
 'dapper-updates': 135,
 'edgy-updates': 197,
 'gutsy-updates': 814,
 'intrepid-alpha-1': 1319,
 'intrepid-alpha-2': 1320,
 'intrepid-alpha-3': 1321,
 'intrepid-alpha-4': 1322,
 'intrepid-alpha-5': 1323,
 'intrepid-alpha-6': 1324,
 'later': 196,
 'ubuntu-8.04.1': 1264,
 'ubuntu-8.04.2': 1425,
 'ubuntu-8.10': 1326,
 'ubuntu-8.10-beta': 1325}

In [8]: myfilter = URLBugListFilter()

In [10]: myfilter.add_option("milestone", (milestones["Ubuntu: gutsy-updates"], milestones["later"]))

In [11]: myfilter.urlopt
Out[11]: 'field.milestone%3Alist=814&field.milestone%3Alist=196'

This is now implemented in the intrepid.merge branch.


Brian Murray (brian-murray) wrote :

I tested this functionality and it worked quite well. I also like how the "Ubuntu:" bit is optional for an Ubuntu milestone.

Markus Korn (thekorn) wrote :

revno: 107
committer: Markus Korn <email address hidden>
branch nick: python-launchpad-bugs
timestamp: Wed 2008-07-02 22:34:33 +0200
  * Improved LPBugList and LPBugPage:
    This two classes have now a cleaner structure, filtering of bug lists
    with python-launchpad-bugs is now a lot easier. With
    LPBugList.set_progress_hook() it is now possible to visualize the
    process of fetching bug lists.
  * launchpadbugs/{tasksbase,html_bug.py,text_bug.py}: if a task is a
    bugwatch then task.remote returns the remote-url, otherwise it returns
  * Improved error handling in python-launchpad-bugs and added
    infrastructure for unittests. This also contains some basic testcases in
    tests/ (LP: #189572)
  * Added ability to parse bugtracker overviews (LP: #203312)
  * It is now possible to filter bug lists based on milestones. This also
    implements a helper function to list all active milestones of a project
    in launchpad (LP: #200457)
  * Added function to filter buglists based on Bug.date_reported
    (LP: #185357)
  * added 'move-duplicates' written by Kjell Braden and 'README' to
    examples/ (LP: #208148)
  * launchpadbugs/attachmentsbase.py: LPAttachment.download() now also
    accepts an optional argument to specify the location where to download
    the attachment (LP: #242317)
  * Added method to let the user choose which version/server of launchpad to
    use, so it is possible to explicit use bugs.launchpad.net or
    bugs.edge.launchpad.net (LP: #188298)
  * launchpadbugs/html_bug.py: InfoTable: fixed parsing of milestones in
    read-only mode (LP: #243057)
  * Added functionality for adding new tasks to bug reports.
    With this implementation so far you are able to add 'project' and
    'distro' tasks, but unable to create bugwatches and change task
    attributes before committing the changes. (LP: #193853)
  * launchpadbugs/html_bug.py: Stephan Hermann fixed html connector to work
    with the newest launchpad rollout (LP: #243193, #244452)
    Unfortunately this update breaks compatibilty. Please update your code
    to make use of the python-launchpad-bugs 0.3 API. It's worth it.

Changed in python-launchpad-bugs:
status: In Progress → Fix Committed
Markus Korn (thekorn) wrote :

Fix released in py-lp-bugs 0.3

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

Other bug subscribers