当前位置: 首页>>代码示例>>Python>>正文


Python Po.mc_bind方法代码示例

本文整理汇总了Python中model.po.Po.mc_bind方法的典型用法代码示例。如果您正苦于以下问题:Python Po.mc_bind方法的具体用法?Python Po.mc_bind怎么用?Python Po.mc_bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.po.Po的用法示例。


在下文中一共展示了Po.mc_bind方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_bind [as 别名]
 def __init__(self, pid, event_list):
     self.pid = pid
     self.place = place_name(pid)
     self.province_id = pid_province(pid)
     event_list.sort(key=lambda x: x.begin_time)
     Po.mc_bind(event_list, 'po', 'id')
     self.event_list = event_list
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:9,代码来源:event_weekly.py

示例2: get

# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_bind [as 别名]
    def get(self, cid, n=1):
        cid = int(cid)
        qs = Reply.where('cid = %s', cid)
        total = qs.count()
        page, limit, offset = page_limit_offset(
            '/reply_list/%s-%%s'%cid,
            total,
            n,
            PAGE_LIMIT,
        )
        li = qs.order_by('id desc')[offset: offset + limit]
        txt_bind(li)
        #print cid == CID_USER
        if cid == CID_USER:
            Wall.mc_bind(li, 'wall', 'rid')
            wall_list = [i.wall for i in li]
            Zsite.mc_bind(wall_list, 'from_user', 'from_id')
            Zsite.mc_bind(wall_list, 'to_user', 'to_id')
        else:
            Po.mc_bind(li, 'po', 'rid')

        Zsite.mc_bind(li, 'user', 'user_id')
        self.render(
            reply_list=li,
            page=page,
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:28,代码来源:reply.py

示例3: get

# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_bind [as 别名]
    def get(self, n=1):
        zsite_id = self.zsite_id
        cid = self.cid
        page_template = self.page_template
        total = fav_po_count_by_user_id_cid(zsite_id, cid)
        n = int(n)

        page, limit, offset = page_limit_offset(
            page_template,
            total,
            n,
            PAGE_LIMIT
        )

        if n != 1 and offset >= total:
            return self.redirect(page_template[:-3])

        li = fav_po_list_by_user_id_cid(zsite_id, cid, limit, offset)

        if cid == CID_WORD:
            rid_po_list = [i for i in li if i.rid]
            Po.mc_bind(rid_po_list, 'question', 'rid')
            Zsite.mc_bind([i.target for i in rid_po_list], 'user', 'user_id')

        self.render(
            cid=cid,
            total=total,
            li=li,
            page=page,
            back_a='/fav',
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:33,代码来源:fav.py

示例4: get

# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_bind [as 别名]
 def get(self, n=1):
     qs = Po.where("state>%s", STATE_RM).where("zsite_id=user_id")
     total = qs.count()
     page, limit, offset = page_limit_offset("/po/zsite-%s", total, n, PAGE_LIMIT)
     li = qs.order_by("id desc")[offset : offset + limit]
     Po.mc_bind(li, "question", "rid")
     self.render(po_list=li, page=page)
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:9,代码来源:po.py

示例5: get

# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_bind [as 别名]
    def get(self, n=1):
        zsite_id = self.zsite_id
        user_id = self.current_user_id
        zsite = self.zsite
        zsite_cid = zsite.cid

        if zsite_cid == CID_SITE:
            self.template = '/ctrl/zsite/po_view/site_po_page.htm'
        else:
            self.template = '/ctrl/zsite/po_view/po_page.htm'


        cid = self.cid
        page_template = self.page_template
        n = int(n)

        if zsite_cid == CID_SITE:
            total = po_cid_count_by_zsite_id(zsite_id, cid)
        else:
            is_self = zsite_id == user_id
            total = po_list_count(zsite_id, cid, is_self)

        page, limit, offset = page_limit_offset(
            page_template,
            total,
            n,
            PAGE_LIMIT
        )

        if n != 1 and offset >= total:
            return self.redirect(page_template[:-3])

        if zsite_cid == CID_SITE:
            po_list = feed_po_list_by_zsite_id(user_id, zsite_id, cid, limit, offset)
            back_a = None
            total = 0
        else:
            po_list = po_view_list(zsite_id, cid, is_self, limit, offset)

            if cid == CID_WORD:
                rid_po_list = [i for i in po_list if i.rid]
                Po.mc_bind(rid_po_list, 'question', 'rid')
                Zsite.mc_bind([i.target for i in rid_po_list], 'user', 'user_id')

            if is_self:
                back_a = '/feed'
            else:
                back_a = '/'


        self.render(
            cid=cid,
            total=total,
            li=po_list,
            page=page,
            back_a=back_a,
        )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:59,代码来源:po_view.py

示例6: get

# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_bind [as 别名]
 def get(self, state, n=1):
     state = int(state)
     qs = Event.where(state=state)
     total = qs.count()
     page, limit, offset = page_limit_offset(
         '/event/%s-%%s' % state,
         total,
         n,
         PAGE_LIMIT,
     )
     li = qs.order_by('id desc')[offset: offset + limit]
     Po.mc_bind(li, 'po', 'id')
     self.render(
         stat=state,
         li=li,
         page=page,
     )
开发者ID:immissile,项目名称:42qu_github_mirror,代码行数:19,代码来源:event.py


注:本文中的model.po.Po.mc_bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。