Example #1
0
    def get(self):
        form = ShareCategoryForm(self.request.arguments)
        if not form.validate():
            raise HTTPError(404)

        category = form.category.data

        existed = yield ShareCategoryDocument.find_one({'name': category})
        if not existed:
            raise HTTPError(404)

        kwargs = yield self.get_sidebar_arguments()

        share_list = yield ShareDocument.get_share_list(
            category=category, limit=SHARE_SETTINGS['share_number_per_page'])

        share_number = yield ShareDocument.get_share_number(category=category)
        uploader_number = yield ShareDocument.get_uploader_number(
            category=category)

        kwargs.update({
            'current_category': category,
            'share_list': share_list,
            'share_number': share_number,
            'uploader_number': uploader_number
        })

        self.render('share/template/share-category.html', **kwargs)
Example #2
0
    def get(self):
        form = ShareCategoryForm(self.request.arguments)
        if not form.validate():
            raise HTTPError(404)

        category = form.category.data

        existed = yield ShareCategoryDocument.find_one({
            'name': category
        })
        if not existed:
            raise HTTPError(404)

        kwargs = yield self.get_sidebar_arguments()

        share_list = yield ShareDocument.get_share_list(
            category=category,
            limit=SHARE_SETTINGS['share_number_per_page']
        )
        share_number = yield ShareDocument.get_share_number(
            category=category
        )
        uploader_number = yield ShareDocument.get_uploader_number(
            category=category
        )

        kwargs.update({
            'current_category': category,
            'share_list': share_list,
            'share_number': share_number,
            'uploader_number': uploader_number
        })

        self.render('share/template/share-category.html', **kwargs)
Example #3
0
    def get(self):
        kwargs = yield self.get_sidebar_arguments()

        recommend_func = ShareDownloadDocument.get_hot_download_list

        recommend_share_list = yield recommend_func()
        uploader_list = yield ShareDocument.get_uploader_list()
        newest_share_list = yield ShareDocument.get_share_list(limit=6)

        kwargs.update({
            'uploader_list': uploader_list,
            'recommend_share_list': recommend_share_list,
            'newest_share_list': newest_share_list
        })

        self.render('share/template/share.html', **kwargs)
Example #4
0
    def get(self):
        kwargs = yield self.get_sidebar_arguments()

        recommend_func = ShareDownloadDocument.get_hot_download_list
        recommend_share_list = yield recommend_func()

        uploader_list = yield ShareDocument.get_uploader_list()
        newest_share_list = yield ShareDocument.get_share_list(limit=6)

        kwargs.update({
            'uploader_list': uploader_list,
            'recommend_share_list': recommend_share_list,
            'newest_share_list': newest_share_list
        })

        self.render('share/template/share.html', **kwargs)