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
1=== modified file 'lib/lp/bugs/doc/bug.txt'
2--- lib/lp/bugs/doc/bug.txt 2009-10-22 15:39:19 +0000
3+++ lib/lp/bugs/doc/bug.txt 2009-10-26 17:15:26 +0000
4@@ -40,6 +40,9 @@
5 It is also possible to retrieve a number of bugs by specifying the bug numbers
6 of interest.
7
8+The method ignores bug numbers not found in the database. That's why the
9+result set below has only one element.
10+
11 >>> result_set = bugset.getByNumbers([6, 1234])
12 >>> print result_set.count()
13 1
14@@ -48,13 +51,13 @@
15 >>> print the_bug_found.title
16 Firefox crashes when Save As dialog for a nonexistent window is closed
17
18- >>> result_set = bugset.getByNumbers([6, 4321, 1])
19+ >>> result_set = bugset.getByNumbers([6, 1])
20 >>> print result_set.count()
21 2
22
23- >>> second_bug_found = result_set[1]
24- >>> print second_bug_found.title
25- Firefox does not support SVG
26+ >>> print [(bug.id, bug.title[:40]) for bug in result_set]
27+ [(1, u'Firefox does not support SVG'),
28+ (6, u'Firefox crashes when Save As dialog for ')]
29
30 If no bug numbers are specified an empty result set is returned.
31
32
33=== modified file 'lib/lp/bugs/model/bug.py'
34--- lib/lp/bugs/model/bug.py 2009-10-22 10:33:00 +0000
35+++ lib/lp/bugs/model/bug.py 2009-10-26 17:15:26 +0000
36@@ -1634,7 +1634,7 @@
37 return EmptyResultSet()
38 store = IStore(Bug)
39 result_set = store.find(Bug, In(Bug.id, bug_numbers))
40- return result_set
41+ return result_set.order_by('id')
42
43
44 class BugAffectsPerson(SQLBase):