[python-bugzilla] Fwd: Complex Query Support

Cole Robinson crobinso at redhat.com
Wed Nov 12 16:18:34 UTC 2014


On 11/12/2014 11:12 AM, Mildred Clarke wrote:
> All,
>
> The python-bugzilla implementation is great but I have one issue that I cannot
> seem to find resolution on. Was hoping that someone here could shed some light
> on the situation. I have attempted a few different ways and upon review of the
> source I don't think* what I am attempting to do is supported in the version I
> am using (1.1.0)
>
> When I attempt to build a complex query, the url_to_query method returns a
> dictionary object that appears to contain the appropriate values. However,
> when attempting to query the remote bugzilla instance an error message is
> displayed and no results are returned.  I believe this is due to the use of
> the "advanced" query format. The error message is complaining about the use of
> "v1" and sometimes "o2". Is it the use of Regex ? Is it my bugzilla instance ?
>
> Message and code snips below.
>
> --- Error Message ---
> Fault: <Fault 53: 'v1 is not a valid parameter for the Bugzilla::Bug::match
> function.'>
>
> --- Error Message ---
> Fault: <Fault 53: 'o2 is not a valid parameter for the Bugzilla::Bug::match
> function.'>
>
>
> --- CODE SNIP ---
> q_url="https://bugzilla.local/query.cgi?bug_status=New&bug_status=Accepted&bug_status=Reopened&f1=cf_custom_field_here&f2=bug_id&f3=alias&o1=regexp&o2=greaterthan&o3=notsubstring&query_format=advanced&v1=^%24&v2=410000&v3=-"
>
> Returns the values in a dictionary with this command --
> bz.url_to_query(q_url)
>
> {'bug_status': ['New', 'Accepted', 'Reopened'],
>   'f1': 'cf_custom_field_here',
>   'f2': 'bug_id',
>   'f3': 'alias',
>   'o1': 'regexp',
>   'o2': 'greaterthan',
>   'o3': 'notsubstring',
>   'query_format': 'advanced',
>   'v1': '^$',
>   'v2': '410000',
>   'v3': '-'}
>
> This is the actual code that will produce the error message. bz is my bugzilla
> connection.
> """ bz.query(bz.url_to_query(q_url)) """. As you can see, I am using the
> "advanced" formatting.  If I don't include the "f*, v*, o*" parameters queries
> return a result set.
>
> Let me know if you need more details to help figure out this issue.
>
> Thanks
>
> Mildred.

The query_format=advanced support is a bugzilla.redhat.com custom extension, 
so probably doesn't work for your local bugzilla instance. There was some talk 
at one point of extending upstream bugzilla to support something similar, but 
AFAICT that doesn't exist yet.

- Cole



More information about the python-bugzilla mailing list