Merge lp:~james-w/launchpad/code-import-request into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Hudson-Doyle | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~james-w/launchpad/code-import-request | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~james-w/launchpad/register-code-import | ||||
Diff against target: |
325 lines (+183/-17) 8 files modified
lib/lp/code/browser/branch.py (+13/-14) lib/lp/code/configure.zcml (+2/-1) lib/lp/code/errors.py (+23/-0) lib/lp/code/interfaces/codeimport.py (+29/-1) lib/lp/code/interfaces/webservice.py (+3/-1) lib/lp/code/model/codeimport.py (+24/-0) lib/lp/code/model/tests/test_codeimport.py (+67/-0) lib/lp/code/stories/webservice/xx-code-import.txt (+22/-0) |
||||
To merge this branch: | bzr merge lp:~james-w/launchpad/code-import-request | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Hudson-Doyle | Approve | ||
Review via email: mp+22727@code.launchpad.net |
Commit message
ICodeImport.
Description of the change
Hi,
This branch adds ICodeImport.
It first adds the method on the interface and model, with associated tests, then exports it over the
webservice with a test that calls the method using that. Lastly it ports the browser code to use
the method to reduce duplication.
The most interesting thing here is the exception handling.
To make a nice API for scripting it doesn't error if it is already queued, as the outcome is the same,
but the browser code needs to know this, so it passes a parameter to find out.
Catching the exceptions in the browser code isn't too pretty, but seemed like the best way to balance
the needs of the two APIs.
The exceptions that can be thrown during webservice access are both marked to trigger a 400 response.
This isn't ideal, as scripts will have a tough time distinguishing them, but choosing arbitrary status codes
to do that is equally ugly. The docstring at least explains what can happen and tells you how to check
for it.
Thanks,
James
Hi,
This adds requestImport() to ICodeImport to allow you to request
that an import happens ASAP.
Thanks,
James