def get(self, zsite_tag_id, n=1): tag = ZsiteTag.mc_get(zsite_tag_id) zsite_id = self.zsite_id user_id = self.current_user_id cid = self.cid is_self = zsite_id == user_id n = int(n) total = zsite_tag_cid_count(zsite_tag_id, cid) page, limit, offset = page_limit_offset( '/tag/%s'%zsite_tag_id + self.page_template, total, n, PAGE_LIMIT ) if n != 1 and offset >= total: return self.redirect(self.page_template[:-3]) po_list = Po.mc_get_list(po_id_list_by_zsite_tag_id_cid(zsite_tag_id, cid, limit, offset)) self.render( cid=cid, is_self=is_self, total=total, li=po_list, page=page, tag_name=Tag.get(tag.tag_id), back_a='/tag/%s'%zsite_tag_id )
def get(self, id, n=1): tag = ZsiteTag.mc_get(id) if tag is None: return self.redirect('/') if tag.zsite_id != self.zsite_id: tag_zsite = Zsite.mc_get(tag.zsite_id) return self.redirect('%s/tag/%s'%(tag_zsite.link, id)) self.render( tag_name=Tag.get(tag.tag_id), zsite_tag_id=id )