Ejemplo n.º 1
0
 def dehydrate(self, bundle):
     bundle = super(ReviewersSearchResource, self).dehydrate(bundle)
     bundle = update_with_reviewer_data(bundle, using_es=True)
     # Filter out anything not present in Meta fields.
     bundle.data = dict(((k, v) for k, v in bundle.data.items()
         if k in self._meta.fields))
     return bundle
Ejemplo n.º 2
0
    def dehydrate(self, bundle):
        obj = bundle.obj
        amo_user = getattr(bundle.request, 'amo_user', None)
        bundle.data.update(app_to_dict(obj,
            region=bundle.request.REGION.id, profile=amo_user))
        bundle.data['privacy_policy'] = (
            PrivacyPolicyResource().get_resource_uri(bundle))

        # Add extra data for reviewers. Used in reviewer tool search.
        bundle = update_with_reviewer_data(bundle)

        return bundle
Ejemplo n.º 3
0
    def dehydrate(self, bundle):
        obj = bundle.obj
        amo_user = getattr(bundle.request, 'amo_user', None)

        bundle.data.update(es_app_to_dict(obj, region=bundle.request.REGION.id,
                                          profile=amo_user,
                                          request=bundle.request))

        # Add extra data for reviewers. Used in reviewer tool search.
        bundle = update_with_reviewer_data(bundle, using_es=True)

        return bundle
Ejemplo n.º 4
0
    def dehydrate(self, bundle):
        obj = bundle.obj
        amo_user = getattr(bundle.request, 'amo_user', None)

        uses_es = waffle.switch_is_active('search-api-es')

        if uses_es:
            bundle.data.update(es_app_to_dict(
                obj, region=bundle.request.REGION.id,
                profile=amo_user))
        else:
            bundle = AppResource().dehydrate(bundle)
            bundle.data['absolute_url'] = absolutify(
                bundle.obj.get_detail_url())

        # Add extra data for reviewers. Used in reviewer tool search.
        bundle = update_with_reviewer_data(bundle)

        return bundle