[python-bugzilla] Problem with my boolean query

Don Zickus dzickus at redhat.com
Wed Apr 24 20:59:56 UTC 2013


On Wed, Apr 24, 2013 at 04:02:33PM -0400, 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?
>  Also, I see that there is a option to use 'flag' for boolean search;
> however, there is no example of how to do this.  Is there possibly a way to
> translate the the boolean query I'm attempting into a flag query?

What happens if you replace 'flagtypes.name' with 'flag'.  I think the
code takes 'boolean_query' and reparses the data inside which means the
'flagtypes.name' might not work.

Then again the magic at this level tends to confuse me.

Another common debug technique I use is to modify

/usr/lib64/python../site-packages/bugzilla/base.py::connect()

self._proxy = xmlrpclib.ServerProxy(url, transport)

to

self._proxy = xmlrpclib.ServerProxy(url, transport, verbose=True)

This gives a good dump showing what is going over the wire.  Run the
'good' query and your code to see what the differences are.  Or post it
here and I can help.

Cheers,
Don


More information about the python-bugzilla mailing list