ValueError raised getting length of batch results
Bug #683115 reported by
Diogo Matsubara
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Gary Poster |
Bug Description
As seen on OOPS-1794M1115 a ValueError: __len__() should return >= 0 was raised getting the length of a batch result.
This might be a bug on lazr.batchnavig
Related branches
lp:~gary/launchpad/bug683115
- Aaron Bentley (community): Approve
-
Diff: 44 lines (+6/-10)2 files modifiedlib/canonical/launchpad/doc/google-searchservice.txt (+4/-7)
lib/canonical/launchpad/utilities/searchservice.py (+2/-3)
Changed in launchpad-foundations: | |
importance: | Medium → High |
Changed in launchpad-foundations: | |
assignee: | nobody → Gary Poster (gary) |
tags: |
added: qa-untestable removed: qa-needstesting |
Changed in launchpad-foundations: | |
status: | Fix Committed → Triaged |
assignee: | Gary Poster (gary) → nobody |
Changed in launchpad-foundations: | |
status: | Triaged → In Progress |
tags: |
added: qa-untestable removed: qa-needstesting |
Changed in launchpad: | |
status: | Fix Committed → Fix Released |
Changed in launchpad: | |
milestone: | none → 11.01 |
To post a comment you must log in.
I dug into this a bit. I do not believe that this is a bug in lazr.batchnavig ator, or at least not in lazr.batchnavig ator.z3batching .batch. The error comes when the len *of the underlying result object* (not the batch itself) is less than zero.
The OOPS is for the search page (lp.app. browser. root.LaunchpadS earchView) , when rendering the expression view/pages/ @@+navigation- links-upper.
"view/pages" in this case is a GoogleBatchNavi gator. It's created in this code:
if len(page_matches) == 0: gator(
page_ matches, self.request, start=start)
return None
navigator = GoogleBatchNavi
The page_matches in that code is the underlying result object. It is defined in lib/canonical/ launchpad/ utilities/ searchservice. py . The value that is a negative number appears to be "total = int(results. find('M' ).text) " in that file. I'd like to test if it is less than zero, and, if so, either raise an error there, or create an informational oops and set total to zero.