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


Python po.Po类代码示例

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


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

示例1: po_user_id_list

def po_user_id_list(question_id):
    question = Po.mc_get(question_id)
    user_id = question.user_id
    po_id_list = rank_po_id_list(question_id, CID_QUESTION, 'confidence')
    po_list = Po.mc_get_list(po_id_list)
    user_id_list = [i.user_id for i in po_list]
    user_id_list.append(user_id)
    return set(user_id_list)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例2: event_kill_extra

def event_kill_extra(from_id, event_id, po_id):
    from notice import notice_event_kill_one, notice_event_kill_mail
    event_po = Po.mc_get(event_id)
    title = event_po.name
    event = Event.mc_get(event_id)
    link = event.link
    po = Po.mc_get(event_id)
    txt = po.name
    notice_link = po.link
    for i in EventJoiner.where(event_id=event_id).where('state>=%s', EVENT_JOIN_STATE_NEW):
        event_joiner_no(i)
        user_id = i.user_id
        notice_event_kill_one(from_id, user_id, po_id)
        notice_event_kill_mail(user_id, title, link, txt, notice_link)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例3: po_event_feedback_new

def po_event_feedback_new(user_id, name, txt, good, event_id, event_user_id):
    if not name and not txt:
        return

    id = event_feedback_id_get(user_id, event_id)

    if id:
        m = Po.mc_get(id)
    else:
        m = po_new(CID_EVENT_FEEDBACK, user_id, name, STATE_ACTIVE, event_id)
        if m:
            id = m.id
            mc_event_feedback_id_get.set('%s_%s' % (user_id, event_id), id)
            m.feed_new()

            from buzz import buzz_event_feedback_new , mq_buzz_event_feedback_owner_new

            if user_id != event_user_id:
                rank_new(m, event_id, CID_EVENT_FEEDBACK)
                buzz_event_feedback_new(user_id, id, event_user_id)
            else:
                mq_buzz_event_feedback_owner_new(user_id, id)

            event_joiner_state_set_by_good(user_id, event_id, good)
    return m
开发者ID:,项目名称:,代码行数:25,代码来源:

示例4: po_event_feedback_list

def po_event_feedback_list(event_id):
    ids = rank_po_id_list(event_id, CID_EVENT_FEEDBACK, 'confidence')

    li = Po.mc_get_list(ids)
    Zsite.mc_bind(li, 'user', 'user_id')

    return li
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: po_recommend_new

def po_recommend_new(rid, user_id, name, reply_id=None):
    '''新建推荐'''
    #判定?
    rec_po = Po.mc_get(rid)
    if not rec_po:
        return
    from po_pos import po_pos_state_buzz
    po_pos_state_buzz(user_id, rec_po)

    recommend = po_new(
        CID_REC,
        user_id,
        name,
        state=STATE_ACTIVE,
        rid=rid
    )
    if recommend:
        recommend.feed_new()

        mc_po_recommend_id_by_rid_user_id.set(
            '%s_%s'%(rid, user_id),
            recommend.id
        )

        if reply_id:
            rr = RecRep(
                id=recommend.id,
                reply_id=reply_id
            )
            rr.save()


        return recommend
开发者ID:,项目名称:,代码行数:33,代码来源:

示例6: render_feed_by_zsite_id

def render_feed_by_zsite_id(zsite_id, limit=MAXINT, begin_id=MAXINT):
    zsite_id_list = zsite_id_list_by_follow(zsite_id)
    rt_dict = defaultdict(list)

    id_list = []
    id = 0
    for i in feed_merge_iter(zsite_id_list, limit, begin_id):
        id = i.id
        po = Po.mc_get(id)
        if po is None:
            continue
        if po.cid == CID_REC:
            id = po.rid
            od = rt_dict[id]
            user_id = po.user_id
            data = (po.id, po.txt,po.user_id)
            od.append(data)
        else:
            id = po.id

        if id not in id_list:
            id_list.append(id)


    return render_feed_list(id_list, zsite_id, rt_dict), id
开发者ID:,项目名称:,代码行数:25,代码来源:

示例7: _po_cid_count_by_zsite_id

def _po_cid_count_by_zsite_id(zsite_id, cid):
    qs = Po.where(
        zsite_id=zsite_id
    ).where('state>=%s'%STATE_PO_ZSITE_SHOW_THEN_REVIEW)
    if cid:
        qs = qs.where(cid=cid)
    return qs.count()
开发者ID:,项目名称:,代码行数:7,代码来源:

示例8: event_end_mail

def event_end_mail(event):
    event_id = event.id
    owner_id = event.zsite_id
    owner = event.zsite
    po = Po.mc_get(event_id)
    rendermail(
        '/mail/event/event_end_owner.txt',
        mail_by_user_id(owner_id),
        owner.name,
        title=po.name,
        link=po.link,
        user_link=owner.link,
        price=event.price,
        feedback_link='/event/feedback/%s' % event_id
    )
    sleep(0.1)

    for user_id in event_joiner_user_id_list(event_id):
        if user_id != owner_id:
            user = Zsite.mc_get(user_id)
            rendermail(
                '/mail/event/event_end_joiner.txt',
                mail_by_user_id(user_id),
                user.name,
                title=po.name,
                link=po.link,
                user_link=user.link,
                feedback_link='/event/feedback/%s' % event_id
            )
            sleep(0.1)
开发者ID:,项目名称:,代码行数:30,代码来源:

示例9: product_rm

def product_rm(com_id , user_id, id):
    po = Po.mc_get(id)
    if po and po.zsite_id == com_id and po.cid == CID_PRODUCT:
        _po_rm(user_id, po)
        mc_product_id_list_by_com_id.delete(com_id)
        from model.po_product_show import product_show_rm
        product_show_rm(po)
开发者ID:,项目名称:,代码行数:7,代码来源:

示例10: event_review_yes

def event_review_yes(id):
    event = Event.mc_get(id)
    #print event,id, event.state

    if event and event.state <= EVENT_STATE_TO_REVIEW:
        event.state = EVENT_STATE_BEGIN
        event.save()
        mc_flush_by_city_pid_cid(event.city_pid, event.cid)

        zsite_id = event.zsite_id
        event_joiner_new(id, zsite_id, EVENT_JOIN_STATE_YES)
        po = Po.mc_get(id)

        if po.zsite_id:
            state = STATE_PO_ZSITE_SHOW_THEN_REVIEW
        else:
            state = STATE_ACTIVE

        po_state_set(po, state)

        notice_event_yes(event.zsite_id, id)

        mc_event_id_list_by_zsite_id.delete('%s_%s'%(zsite_id, False))

        mq_rendermail(
            '/mail/event/event_review_yes.txt',
            mail_by_user_id(event.zsite_id),
            event.zsite.name,
            link=po.link,
            title=po.name,
            price=event.price
        )
开发者ID:,项目名称:,代码行数:32,代码来源:

示例11: event_feedback_id_get

def event_feedback_id_get(user_id, event_id):
    c = Po.raw_sql(
            'select id from po where rid=%s and cid=%s and user_id=%s and state>%s', event_id, CID_EVENT_FEEDBACK, user_id, STATE_RM
        )
    r = c.fetchone()
    if r:
        return r[0]
    return 0
开发者ID:,项目名称:,代码行数:8,代码来源:

示例12: po_review_id_get

def po_review_id_get(zsite_id, user_id):
    c = Po.raw_sql(
'select id from po where zsite_id=%s and user_id=%s and cid=%s',
zsite_id, user_id, CID_REVIEW
    )
    r = c.fetchone()
    if r:
        return r[0]
    return 0
开发者ID:,项目名称:,代码行数:9,代码来源:

示例13: po_id_list_by_zsite_id

def po_id_list_by_zsite_id(zsite_id, cid, limit, offset):
    qs = Po.where(
        zsite_id=zsite_id
    ).where('state>=%s'%STATE_PO_ZSITE_SHOW_THEN_REVIEW)

    if cid:
        qs = qs.where(cid=cid)

    return qs.order_by('id desc').col_list(limit, offset)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例14: po_recommend_id_by_rid_user_id

def po_recommend_id_by_rid_user_id(rid, user_id):
    c = Po.raw_sql(
        'select id from po where rid=%s and user_id=%s and cid=%s and state = %s',
        rid, user_id, CID_REC, STATE_ACTIVE
    )
    r = c.fetchone()
    if r:
        return r[0]
    return 0
开发者ID:,项目名称:,代码行数:9,代码来源:

示例15: notice_event_notice

def notice_event_notice(from_id, event_id, po_id):
    from event import event_joiner_user_id_list
    po = Po.mc_get(event_id)
    title = po.name
    link = po.link
    notice_po = Po.mc_get(po_id)
    txt = notice_po.name
    notice_link = notice_po.link
    for user_id in event_joiner_user_id_list(event_id):
        notice_new(from_id, user_id, CID_NOTICE_EVENT_NOTICE, po_id)
        name = Zsite.mc_get(user_id).name
        mail = mail_by_user_id(user_id)
        rendermail('/mail/event/event_notice.txt',
                   mail, name,
                   title=title,
                   link=link,
                   txt=txt,
                   notice_link=notice_link,
                  )
开发者ID:,项目名称:,代码行数:19,代码来源:


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