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?
Thanks!
Eric
On Wed, Apr 24, 2013 at 4:58 PM, Cole Robinson <crobinso(a)redhat.com> wrote:
On 04/24/2013 04:02 PM, Eric Sammons wrote:
> Hi,
>
> I'm trying to write a simple python program that would search for all
bugs
> with a specific set of flags. Using the bugzilla cli the boolean query
works.
>
> <cli>
> bugzilla query --product='Red Hat Enterprise MRG'
--component='distribution,
> qpid-cpp, qpid-java, qpid-jca'
> --boolean_query='flagtypes.name-substring-mrg-2.4.0 &
> flagtypes.name-notsubstring-mrg-2.4.0-'
> </cli>
>
> When I try to use the following, I receive a malformed boolean error.
>
> <code>
> bz_boolean = 'flagtypes.name-substring-mrg-2.4.0 &
> flagtypes.name-notsubstring-mrg-2.4.0-'
> bz = bugzilla.Bugzilla(url = bzurl)
> query_in = bz.build_query(
> product = "Red Hat Enterprise MRG",
> component = MRGM,
> boolean_query = bz_boolean)
> query_out = bz.query(query_in)
> for i in query_out:
> print i
> </code>
>
> RuntimeError: Malformed boolean query:
flagtypes.name-substring-mrg-2.4.0 &
> flagtypes.name-notsubstring-mrg-2.4.0-
>
> What am I doing wrong here or is it possible there is a bug in the
library?
Yep, it's a bug. The API wanted boolean_query only as a list. I've pushed a
commit now that handles it as both a string and a list.
If you aren't using git, you can fix it by altering your code above like
...
boolean_query = [bz_boolean])
...
- Cole
--
Eric L. Sammons esammons(a)redhat.com
Manager Quality Engineering irc: eanxgeek
Red Hat Quality Engineering 919.754.4963 (w)
rhce # 805007668329332 919.889.3279 (c)
rhcva # 805007668329332