← Back to team overview

launchpad-dev team mailing list archive

Re: Filtering out conjoined/private bugs in python with no extra DB queries

 

On 21/03/12 04:57, Stuart Bishop wrote:
> On Mon, Mar 19, 2012 at 11:37 PM, Guilherme Salgado
> <guilherme.salgado@xxxxxxxxxx> wrote:
> 
>>  (This is for ProductSeries tasks; need similar for DistroSeries)
>>  if productseries is not None and product is None:
>>      if (productseries.id == productseries.product.development_focusID
>>          and task.status not in BugTask._NON_CONJOINED_STATUSES):
>>          continue
>>
>> The above would skip the master tasks in a conjoined relationship,
>> leaving the slave in the list returned to the page, but it would not
>> cause extra queries since I fetch the product/productseries as well. I'd
>> like to know if that's reasonable or if there's a better way (which
>> doesn't involve rewriting bug searching in LP ;) to achieve what I want?
> 
> This approach seems preferable to issuing multiple queries. Worst case
> seems to be you throw away half the rows, but normally nowhere near
> that.

Cool, I've wrote some tests for it and it seems to be working fine.

> 
>> Oh, and I have the same kind of problem to filter out private bugs, but
>> I'm hoping there the extra queries issued when filtering them out in
>> python are not too big a deal because there shouldn't be many private
>> bugs in that page (for the vast majority of teams, at least) and the
>> checks to decide whether or not to show a private bug should consist
>> mostly of inTeam() calls, which are cached.  I'm going to write some
>> tests to check how many extra queries that would incur (assuming I fetch
>> the bug's owner as well), but I'd like to know if you guys think it's
>> possible we can afford that sort of thing?
> 
> Bug privacy is currently being overhauled. Hopefully  you can exclude
> the private bugs in your initial query without much pain.

It actually turned out that I could simply append the filter returned by
get_bug_privacy_filter() to my query to filter out the bugs the user is
not allowed to see.  I guess I should talk to the people who are working
on this overhaul you mention to see if that's really what I should be using.

Cheers,

-- 
Guilherme Salgado <https://launchpad.net/~salgado>

Attachment: signature.asc
Description: OpenPGP digital signature


References