コード例 #1
0
    def obj_get_list(self, request=None, **kwargs):
        form = Featured(request.GET,
                        region=getattr(request, 'REGION',
                                       regions.WORLDWIDE).slug)
        if not form.is_valid():
            raise self.form_errors(form)

        return Webapp.featured(**form.as_featured())
コード例 #2
0
ファイル: api.py プロジェクト: flyun/zamboni
    def obj_get_list(self, request=None, **kwargs):
        form = Featured(request.GET,
                        region=getattr(request, 'REGION',
                                       regions.WORLDWIDE).slug)
        if not form.is_valid():
            raise self.form_errors(form)

        return Webapp.featured(**form.as_featured())
コード例 #3
0
ファイル: api.py プロジェクト: flyun/zamboni
    def get_list(self, request, **kwargs):
        form = Featured(request.GET,
                        region=getattr(request, 'REGION',
                                       regions.WORLDWIDE).slug)
        if not form.is_valid():
            raise self.form_errors(form)

        data = form.as_featured()
        # By default the home page has no category.
        data['cat'] = None
        # Regardless of the limit, we will override that.
        data['limit'] = 9 if data['mobile'] else 12

        cat = CategoryResource()
        featured = Webapp.featured(**data)

        return self.create_response(request, {
            'categories': cat.dehydrate_objects(cat.obj_get_list()),
            'featured': AppResource().dehydrate_objects(featured)
        })
コード例 #4
0
    def get_list(self, request, **kwargs):
        form = Featured(request.GET,
                        region=getattr(request, 'REGION',
                                       regions.WORLDWIDE).slug)
        if not form.is_valid():
            raise self.form_errors(form)

        data = form.as_featured()
        # By default the home page has no category.
        data['cat'] = None
        # Regardless of the limit, we will override that.
        data['limit'] = 9 if data['mobile'] else 12

        cat = CategoryResource()
        featured = Webapp.featured(**data)

        return self.create_response(
            request, {
                'categories': cat.dehydrate_objects(cat.obj_get_list()),
                'featured': AppResource().dehydrate_objects(featured)
            })
コード例 #5
0
ファイル: test_api.py プロジェクト: flyun/zamboni
 def lookup(self, region, device):
     form = Featured({'dev': device}, region=region)
     ok_(form.is_valid(), form.errors)
     return form.as_featured()
コード例 #6
0
ファイル: test_api.py プロジェクト: jvillalobos/zamboni
 def lookup(self, region, device):
     form = Featured({'dev': device}, region=region)
     ok_(form.is_valid(), form.errors)
     return form.as_featured()