Merge lp://staging/~brendan-donegan/checkbox-certification/return_status_url into lp://staging/checkbox-certification

Proposed by Brendan Donegan
Status: Merged
Approved by: Daniel Manrique
Approved revision: 578
Merged at revision: 577
Proposed branch: lp://staging/~brendan-donegan/checkbox-certification/return_status_url
Merge into: lp://staging/checkbox-certification
Diff against target: 46 lines (+17/-2)
2 files modified
bin/checkbox-certification-submit (+14/-0)
debian/changelog (+3/-2)
To merge this branch: bzr merge lp://staging/~brendan-donegan/checkbox-certification/return_status_url
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Brendan Donegan (community) Needs Resubmitting
Review via email: mp+158623@code.staging.launchpad.net

Description of the change

HEXR now has a feature to return a url which leads to a page showing the status of a submission (e.g. processing/processed). This merge updates checkbox-certification-submit to display the url so that people using it can use the HEXR feature. The same has not been done in the certify_new_transport since that involves possible changes to the Checkbox UI which may take a bit longer to implement.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

One thing to fix:

25 + logging.info("Submission status: " + base_url + status['url'])

Best to use logging's string interpolation stuff here:

logging.info("Submission status: %s%s", base_url, status['url'])

Also, a couple of comments.

Do you want to handle the situation in which the server doesn't return json (in which case json.loads will throw an exception), and the situation in which the json is *not* what you expect (status['url'] will throw KeyError)?

Then, a minor nitpick:

17 + split_url = args.rest_transport.split('//')
18 + base_url = '//'.join([split_url[0],
19 + split_url[1].split('/')[0]])

This works, but looks a bit crazy, I suggest the following code, which is also only 3 lines (including import) and IMHO clearer in what it does:

import urllib.parse
url_parts = urllib.parse.urlparse(args.rest_transport)
base_url = urllib.parse.urlunparse((url_parts.scheme, url_parts.netloc, "", "", ""))

Your code works fine, however, so I'm cool either way.

review: Needs Fixing
578. By Brendan Donegan

Use nicer url handling code and handle exceptions caused by possibly incorrect status URL returned by HEXR.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Good comments, thanks! I hope the code I've pushed looks better.

review: Needs Resubmitting
Revision history for this message
Daniel Manrique (roadmr) wrote :

Awesome, glad the urllib example was useful. +1, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches