Merge lp://staging/~sinzui/charmworld/api3-search into lp://staging/~juju-jitsu/charmworld/trunk
Status: | Merged |
---|---|
Merged at revision: | 359 |
Proposed branch: | lp://staging/~sinzui/charmworld/api3-search |
Merge into: | lp://staging/~juju-jitsu/charmworld/trunk |
Diff against target: |
435 lines (+133/-38) 3 files modified
charmworld/health.py (+1/-1) charmworld/views/api.py (+41/-12) charmworld/views/tests/test_api.py (+91/-25) |
To merge this branch: | bzr merge lp://staging/~sinzui/charmworld/api3-search |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | Approve | ||
Review via email: mp+181092@code.staging.launchpad.net |
Commit message
Introduce API3.search.
Description of the change
Introduce API3.search.
RULES
Pre-
* Changes the API3.charms() method to be search() and return both
charms and bundles.
* Preserver API2.charms.
* Solve the interesting() call in a future branch
* Base this work on the API search branch from the bundles sprint.
NEXT
* Update index_client.
returning.
* Update all the callsites to unpack the item or pass doctype.
FUTURE
* Update interesting to support bundles.
* Create a form to allow ~charmers to feature a bundle
QA
* Visit http://
* Verify the result[] contains only charms. 1 is the expected count.
* Visit http://
* Verify the result[] contains charms and bundles. 2 is the expected
count.
IMPLEMENTATION
I copied charms() to API2 and added
kwargs[
to ensure it always specifies it wants charms. I Then renamed API3.charms()
to search. The tests were updated to call the proper endpoint. I changed
_charm_results to _item_results. item_results() knows about bundles, but
the method is incomplete. How do API consumers know what each item is?
The api_search() method isn't helping.
! Should the metadata dict contain doctype info? I think the GUI will
find something like this practical for both charms and bundles.
metadata: {"doctype": "bundle"}
I am inclined to change the metadata in this branch if we know for certain
that API3 should do this. This would also make the tests clearer when
we can check the metadata.
charmworld/
charmworld/
I updated the API3 health check to call the search method.
charmworld/
Just curious, did you mean to use "_" as a dummy assignment var? I picked that up in JS but we've decide against it in Python since it can clash with real uses.
As we discussed on IRC, I think adding a 'doctype' to the metadata makes sense.
It's a shame you have to go through that non-sense to figure out if it is a bundle for looking for 'basket'.
The rest looks good. Thanks.