[python-bugzilla] getbug(id,include_fields=...)

Cole Robinson crobinso at redhat.com
Fri Aug 1 15:03:26 UTC 2014


On 08/01/2014 09:58 AM, Eric Sammons wrote:
> I'm trying to use the getbug() method of python-bugzilla to get more details
> (extract additional fields) from specific bugs; however, I am apparently
> missing something.
> 
>>>> import bugzilla
> 
>>>> bz = bugzilla.Bugzilla('https://bugzilla.redhat.com/xmlrpc.cgi')
> 
>>>> bz.login(user,password)
> 
>>>> bz.getbug('111111')
> <Bug #111111 on https://bugzilla.redhat.com/xmlrpc.cgi at 0x175fd90>
> 
>>>> print bz.getbug('111111')
> #111111 CLOSED     - hp at redhat.com <mailto:hp at redhat.com> - libgnomeui should
> BuildRequires: libjpeg-devel
> 

Instead do

bug = bz.getbug('111111')
print bug.cf_qa_whiteboard

>>>> print bz.getbug('111111', include_fields=['cf_qa_whiteboard']
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 983, in getbug
>     exclude_fields=exclude_fields, extra_fields=extra_fields)
>   File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 976, in _getbug
>     extra_fields=extra_fields)[0]
>   File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 951, in _getbugs
>     bugdict = dict([(b['id'], b) for b in r['bugs']])
> KeyError: 'id'
> 

This is our bug, we should ensure 'id' is always present if include_fields is
used. We do that with querying but not getbug

- Cole


More information about the python-bugzilla mailing list