Merge lp:~james-w/pkgme-devportal/better-api into lp:pkgme-devportal
Status: | Merged |
---|---|
Approved by: | James Westby |
Approved revision: | no longer in the source branch. |
Merged at revision: | 107 |
Proposed branch: | lp:~james-w/pkgme-devportal/better-api |
Merge into: | lp:pkgme-devportal |
Diff against target: |
465 lines (+138/-105) 10 files modified
devportalbinary/backend.py (+7/-18) devportalbinary/backends/binary/all_info (+3/-3) devportalbinary/backends/binary/want (+3/-3) devportalbinary/backends/pdf/all_info (+3/-3) devportalbinary/backends/pdf/want (+3/-3) devportalbinary/binary.py (+9/-1) devportalbinary/metadata.py (+22/-0) devportalbinary/pdf.py (+9/-1) devportalbinary/tests/test_backend.py (+40/-73) devportalbinary/tests/test_metadata.py (+39/-0) |
To merge this branch: | bzr merge lp:~james-w/pkgme-devportal/better-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jonathan Lange | Approve | ||
Review via email: mp+123772@code.launchpad.net |
Commit message
Add a more direct API for error handling and serialization of backends.
Description of the change
Hi,
Here's the start of an attempt to straighten out the APIs in pkgme-devportal.
This makes backend_script more directly reflect the API of a backend script
(though perhaps the path could be implicit as it's defined to be $PWD for
backends). It takes a function and just wraps it in the error handling
and serialization.
Next it removes the want() and all_info() functions because they are
specific to a particular way of writing a backend. In fact they move
to metadata.py and become function generators, which take a MetadataBackend
subclass and wrap it with the necessary stuff.
The rest is just changes to match this change.
I felt that this was a better organization, but it's not where I'll be stopping.
The stuff in metadata.py still assumes too much, and the MetadataBackend
class still does too much, but now I can change that to fit a better API
than before.
Thanks,
James
Looks good to me.
I'm not sure why make_all_info_fn and make_want_fn wrap their returns in backend_script. Maybe that should be done in the scripts themselves? It doesn't really matter.
I look forward to seeing where this goes.
Thanks,
jml