Beispiel #1
0
    def GET(self, catslug, pgno=1):
        cat = get_category_by_slug(catslug)
        pagination = Pagination(info_record_query2(cat.id), info_count_query2(cat.id), pgno)
        qs = pagination.queryset
        entities = qs.all()

        # import pdb
        # pdb.set_trace()

        category_ancestors = get_category_ancestors(cat)

        req = web.ctx.req
        req.update(
            {
                "entities": entities,
                "category_ancestors": category_ancestors,
                "thecat": cat,
                "pagination": pagination,
                "get_latest_entities": get_latest_entities,
            }
        )

        template = cat.template and cat.template.list_file or None
        if not template or not template_exist(template):
            template = web.config.default_category_list
        return info_render.render(template, **req)
Beispiel #2
0
 def GET(self, slug):
     cat = get_category_by_slug(slug)
     req = web.ctx.req
     req.update({"thecat": cat, "get_latest_entities": get_latest_entities, "get_entity": get_entity})
     template = cat.template and cat.template.index_file or None
     # if template:
     #    web.debug("111 cat:%s 's template:%s" % (cat.slug, template))
     if not template or not template_exist(template):
         template = web.config.default_category_index
     # if template:
     #    web.debug("222 cat:%s 's template:%s" % (cat.slug, template))
     return info_render.render(template, **req)