Bug 606695

Summary: XML-RPC: comment "body" attribute renamed to "thetext"?
Product: [Community] Bugzilla Reporter: Petr Šplíchal <psplicha>
Component: WebServiceAssignee: Noura El hawary <nelhawar>
Status: CLOSED NEXTRELEASE QA Contact: Petr Šplíchal <psplicha>
Severity: medium Docs Contact:
Priority: low    
Version: 3.6CC: ohudlick
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-25 17:56:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 595877    

Description Petr Šplíchal 2010-06-22 09:07:59 UTC
Description of problem:

I've tested rhts-wizard [1] with the updated XML-RPC interface at
bz-web2-test.devel.redhat.com/xmlrpc.cgi The script failed with:

    File "./rhts-wizard", line 1544, in getDescription
        return self.bug.longdescs[0]["body"]
    KeyError: 'body'

Seems the "body" attribute has been renamed to "thetext" for
comments:

    longdescs[0]["body"] -> to longdescs[0]["thetext"]

Is this change expected? Will Bugzilla support the "body"
attribute to be backward compatible? Or shall I update the wizard?

Version-Release number of selected component (if applicable):
version 3.6+

[1] https://wiki.test.redhat.com/BaseOs/Projects/RhtsWizard

Comment 1 Noura El hawary 2010-06-22 12:28:39 UTC
Hi Petr,

yes you are right the body attribute has been renamed to "thetext" so basically this the new attributes of the longdescs field:

          'longdescs' => [
                         {
                           'count' => '0',
                           'thetext' => ''
                           'author' => {
                                     },
                           'bug_id' => ,
                           'email' =>                   
                           'work_time' => ,
                           'comment_id' => ,
                           'who' => ,
                           'bug_when' => ,
                           'isprivate' => ,
                           'already_wrapped' => ,
                           'type' => 
                         },

Regards,
Noura

Comment 2 David Lawrence 2010-06-22 15:43:09 UTC
(In reply to comment #1)
> Hi Petr,
> 
> yes you are right the body attribute has been renamed to "thetext" so basically

Petr, which method are you using to get the bug details? Bug.get and Bug.comments or are you using bugzilla.getBug? 

If you are using the latter, then maybe consider updating your scripts to use the former two calls as they are the upstream API and less likely to change going forward. 

Noura, can you update the bugzilla.* and RedHat.* methods to change 'thetext' to 'body' before returning the data? This change is going to affect other people as well I am sure.

Dave

Comment 3 Noura El hawary 2010-06-23 11:55:01 UTC
Hi Dave,

the only functions i found that return thetext are RedHat.getBug and bugzilla.getBug I changed that to be body instead.

with the upstream API Bug.comments returns thetext but we will leave that as you mentioned to be constant with the upstream API.

the patch has been applied to bz-web2, Petr please run your test again and see if it has been fixed. also committed to svn.

Cheers,
Noura

Comment 4 David Lawrence 2010-06-23 19:14:41 UTC
(In reply to comment #3)
> the only functions i found that return thetext are RedHat.getBug and
> bugzilla.getBug I changed that to be body instead.

Any methods in extensions/RedHat/lib/WebService/* that access and return 
$bug->comments will need to have the key 'thetext' converted to 'body'. 
$bug->comments replaces $bug->longdescs in 3.4. If the places you found 
were the only ones then we should be good.

> with the upstream API Bug.comments returns thetext but we will leave that as
> you mentioned to be constant with the upstream API.

Yes the upstream API will remain 'thetext'.

Petr, if this works for you then feel free to close this bug.

Dave

Comment 5 Petr Šplíchal 2010-06-25 14:15:39 UTC
Verified, works fine now. Thanks for fixing!

> Petr, which method are you using to get the bug details? Bug.get
> and Bug.comments or are you using bugzilla.getBug? 
> 
> If you are using the latter, then maybe consider updating your
> scripts to use the former two calls as they are the upstream API
> and less likely to change going forward. 

I'm using python-bugzilla's method getbug() which seems to be
implemented using the old interface:

    #---- Methods for reading bugs and bug info

    def _getbug(self,id):
        '''Return a dict of full bug info for the given bug id'''
        return self._proxy.bugzilla.getBug(id)

So I guess I should file a bug against python-bugzilla, right?

Comment 6 David Lawrence 2010-06-25 17:56:18 UTC
(In reply to comment #5)
> Verified, works fine now. Thanks for fixing!

Thanks for verifying.

> 
> > Petr, which method are you using to get the bug details? Bug.get
> > and Bug.comments or are you using bugzilla.getBug? 
> > 
> > If you are using the latter, then maybe consider updating your
> > scripts to use the former two calls as they are the upstream API
> > and less likely to change going forward. 
> 
> I'm using python-bugzilla's method getbug() which seems to be
> implemented using the old interface:
> 
>     #---- Methods for reading bugs and bug info
> 
>     def _getbug(self,id):
>         '''Return a dict of full bug info for the given bug id'''
>         return self._proxy.bugzilla.getBug(id)
> 
> So I guess I should file a bug against python-bugzilla, right?    

Yep. I think the python-bugzilla author will be the one to do the changes.

Dave