Merge lp:~al-maisan/launchpad/bq into lp:launchpad

Proposed by Muharem Hrnjadovic
Status: Merged
Merged at revision: not available
Proposed branch: lp:~al-maisan/launchpad/bq
Merge into: lp:launchpad
Diff against target: 44 lines
2 files modified
lib/lp/bugs/doc/bug.txt (+7/-4)
lib/lp/bugs/model/bug.py (+1/-1)
To merge this branch: bzr merge lp:~al-maisan/launchpad/bq
Reviewer Review Type Date Requested Status
Aaron Bentley (community) code Approve
Review via email: mp+13971@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

This branch adds result set ordering to BugSet.getByNumbers() and enhances the related tests.

Tests to run:

    bin/test -t doc/bug.txt

Revision history for this message
Aaron Bentley (abentley) wrote :

Looks good.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/doc/bug.txt'
--- lib/lp/bugs/doc/bug.txt 2009-10-22 15:39:19 +0000
+++ lib/lp/bugs/doc/bug.txt 2009-10-26 17:15:26 +0000
@@ -40,6 +40,9 @@
40It is also possible to retrieve a number of bugs by specifying the bug numbers40It is also possible to retrieve a number of bugs by specifying the bug numbers
41of interest.41of interest.
4242
43The method ignores bug numbers not found in the database. That's why the
44result set below has only one element.
45
43 >>> result_set = bugset.getByNumbers([6, 1234])46 >>> result_set = bugset.getByNumbers([6, 1234])
44 >>> print result_set.count()47 >>> print result_set.count()
45 148 1
@@ -48,13 +51,13 @@
48 >>> print the_bug_found.title51 >>> print the_bug_found.title
49 Firefox crashes when Save As dialog for a nonexistent window is closed52 Firefox crashes when Save As dialog for a nonexistent window is closed
5053
51 >>> result_set = bugset.getByNumbers([6, 4321, 1])54 >>> result_set = bugset.getByNumbers([6, 1])
52 >>> print result_set.count()55 >>> print result_set.count()
53 256 2
5457
55 >>> second_bug_found = result_set[1]58 >>> print [(bug.id, bug.title[:40]) for bug in result_set]
56 >>> print second_bug_found.title59 [(1, u'Firefox does not support SVG'),
57 Firefox does not support SVG60 (6, u'Firefox crashes when Save As dialog for ')]
5861
59If no bug numbers are specified an empty result set is returned.62If no bug numbers are specified an empty result set is returned.
6063
6164
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2009-10-22 10:33:00 +0000
+++ lib/lp/bugs/model/bug.py 2009-10-26 17:15:26 +0000
@@ -1634,7 +1634,7 @@
1634 return EmptyResultSet()1634 return EmptyResultSet()
1635 store = IStore(Bug)1635 store = IStore(Bug)
1636 result_set = store.find(Bug, In(Bug.id, bug_numbers))1636 result_set = store.find(Bug, In(Bug.id, bug_numbers))
1637 return result_set1637 return result_set.order_by('id')
16381638
16391639
1640class BugAffectsPerson(SQLBase):1640class BugAffectsPerson(SQLBase):