[python-bugzilla] Problem with my boolean query

Cole Robinson crobinso at redhat.com
Wed Apr 24 22:12:34 UTC 2013


On 04/24/2013 05:54 PM, Eric Sammons wrote:
> Thanks, I used the suggested code modification and it worked; however, I have
> encountered a new and interesting problem.
> 
> My build_query is set up as follows:
> 
> <code>
> status='NEW, ASSIGNED, ON_DEV, POST, MODIFIED, ON_QA'
> 
> query_in = bz.build_query(
> 
>                               product = "Red Hat Enterprise MRG",
>                               component = MRGM,
>                               flag = 'mrg-2.4.0',
>                               status = status,
>                               boolean_query = [bz_boolean])
> 
> query_out = bz.query(query_in)
> </code>
> 
> query_out includes bugs that are in the CLOSED state as well.  I assumed that
> my built query was ANDed so all conditions had to be true to satisfy.
> 
> Thoughts?
> 

In the future please post a full code example, makes it easier for someone to
reproduce.

You need to turn that status field into a list. This is different from the
boolean query, because your boolean string was one long query, but your status
string is actually 6 distinct statuses. You could convert that string by
sticking on .split(", ")

An easy way to figure out how to convert query bits to API code is to do

  bugzilla --debug query <your-query-options>

And look at the generated query in the debug output, and try and work back
from there.

- Cole


More information about the python-bugzilla mailing list