Hi Dan, You're correct, this is a bug, and your fix looks fine. We'll have to get that fix in. Want to post a review request?
Christian On Wednesday, January 12, 2011, Dan <[email protected]> wrote: > Here is a more accurate description: > > In ReviewBoardServer.get_repository_info, it calls > ReviewBoardServer.api_get to fetch the repository info from sever, > from my debug, it show the return json is something like (if the > repository is svn) > > { > "stat": "ok", > "repository": { > "path": "http://192.168.1.131/svn/Android", > "tool": "Subversion", > "id": 2, > "links": { > "info": { > "href": "http://192.168.1.131:81/api/repositories/2/ > info/", > "method": "GET" > }, > "self": { > "href": "http://192.168.1.131:81/api/repositories/ > 2/", > "method": > "GET" > } > }, > "name": "local-android" > } > } > > from the data structure of the json, we can see that use "url = > rsp['links']['info']['href']" of course will get a array key > exception. > should use url = rsp['repository']['links']['info']['href']. > > Is this a bug? > > > > > On Jan 11, 9:24 pm, Dan <[email protected]> wrote: >> Hi >> >> Here I have a problem with postreview.py when publish a review >> request, could anyone please have a look? >> >> My enviroment is Reviewboard 1.5.1 and SVN. I downloaded postreview.py >> fromhttps://github.com/reviewboard/rbtools/blob/184334a7a5ddc24172ae2aa03..., >> and configed the constants necessary. >> >> When I run postreivew, it throws a array index exception at line 677: >> url = rsp['links']['info']['href'], The whole piece of code is >> >> def get_repository_info(self, rid): >> """ >> Returns detailed information about a specific repository. >> """ >> if self.deprecated_api: >> url = 'api/json/repositories/%s/info/' % rid >> else: >> rsp = self.api_get( >> '%s%s/' % (self.root_resource['links']['repositories'] >> ['href'], >> rid)) >> url = rsp['links']['info']['href'] >> >> rsp = self.api_get(url) >> >> return rsp['info'] >> >> I added debug info for rep, it did not contain the "links" index >> indeed, but it contained a "repository" index. >> >> Then I manually went to check the xml from reviewboard server, and >> found the structure of the xml is like this >> <rsp> >> <repository> >> <links> >> <info> >> <href> >> so I changed line 677 to url = rsp["repository"]['links']['info'] >> ['href'], finally it worked. >> >> Though it worked, I still did not know the reason and whether my >> change is right or wrong. I think it is unlike to be a bug of >> reviewboard, but I am too lazy to read all the code :-) so, could >> anyone kindly tell me that what the real problem is and what should I >> do? >> >> Any help will be highly appreciated! > > -- > Want to help the Review Board project? Donate today at > http://www.reviewboard.org/donate/ > Happy user? Let us know at http://www.reviewboard.org/users/ > -~----------~----~----~----~------~----~------~--~--- > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/reviewboard?hl=en -- -- Christian Hammond - [email protected] Review Board - http://www.reviewboard.org VMware, Inc. - http://www.vmware.com -- Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/ Happy user? Let us know at http://www.reviewboard.org/users/ -~----------~----~----~----~------~----~------~--~--- To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en
