~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/views/api.py

[r=benji][bug=][author=sinzui] Update IndexClient.api_search to include the doctype of the found document.

Show diffs side-by-side

added added

removed removed

Lines of Context:
508
508
    def _item_results(self, items):
509
509
        results = []
510
510
        for item in items:
511
 
            # XXX: sinzui: api_search() stripped the doctype.
512
 
            # A formatter might be needed.
513
 
            if 'basket' in item:
 
511
            if item['doctype'] == BUNDLE:
514
512
                result = {
515
 
                    'bundle': Bundle(item)._representation,
 
513
                    'bundle': Bundle(item['data'])._representation,
516
514
                    'metadata': {
517
515
                        'doctype': BUNDLE
518
516
                    }
519
517
                }
520
518
            else:
521
 
                result = self._charm_result(Charm(item))
 
519
                result = self._charm_result(Charm(item['data']))
522
520
            results.append(result)
523
521
        return results
524
522