Exemple #1
0
def _po_rm(user_id, po):
    po.state = STATE_RM
    po.save()
    id = po.id
    feed_rm(id)

    from model.po_show import po_show_rm
    po_show_rm(id)

    from model.po_recommend import mq_rm_rec_po_by_po_id
    mq_rm_rec_po_by_po_id(user_id, id)

    from zsite_tag import zsite_tag_rm_by_po
    zsite_tag_rm_by_po(po)

    from po_tag import po_tag_rm_by_po
    po_tag_rm_by_po(po)

    from rank import rank_rm_all
    rank_rm_all(id)

    from po_question import mc_answer_id_get, answer_count
    rid = po.rid
    if rid:
        mc_answer_id_get.delete('%s_%s' % (user_id, rid))
        answer_count.delete(rid)
    mc_flush(user_id, po.cid)
    mq_buzz_po_rm(id)
    from fav import fav_rm_by_po
    fav_rm_by_po(po)
    return True
Exemple #2
0
def po_state_set(po, state):
    old_state = po.state
    if old_state == state:
        return
    po.state = state
    po.save()
    cid = po.cid
    mc_flush_other(po.user_id, cid)
    mc_flush_zsite_cid(po.zsite_id, cid)
    id = po.id
    if old_state > STATE_SECRET and state == STATE_SECRET:
        feed_rm(id)
        po.tag_rm()
        mq_buzz_po_rm(id)
        from fav import fav_rm_by_po
        fav_rm_by_po(po)
    elif old_state < STATE_ACTIVE and state >= STATE_ACTIVE:
        po.feed_new()
        po.tag_new()