Exemple #1
0
def vote_mc_flush(user_id, po_id):
    mc_vote_state.delete('%s_%s' % (user_id, po_id))
    po_id = str(po_id)
    vote_up_count.delete(po_id)
    vote_down_count.delete(po_id)
    vote_count.delete(po_id)
    mc_vote_user_id_list.delete(po_id)
    mc_feed_tuple.delete(po_id)
    from rank import rank_update
    rank_update(po_id)
Exemple #2
0
def vote_mc_flush(user_id, po_id):
    mc_vote_state.delete('%s_%s' % (user_id, po_id))
    po_id = str(po_id)
    vote_up_count.delete(po_id)
    vote_down_count.delete(po_id)
    vote_count.delete(po_id)
    mc_vote_user_id_list.delete(po_id)
    mc_feed_tuple.delete(po_id)
    from rank import rank_update
    rank_update(po_id)
Exemple #3
0
def reply_rm_if_can(user_id, id):
    can_admin = None
    r = Reply.mc_get(id)
    if r:
        po = Po.mc_get(r.rid)
        if po:
            can_admin = r.can_admin(user_id) or po.can_admin(user_id)
            if can_admin:
                r.rm()
                mc_feed_tuple.delete(po.id)
    return can_admin
Exemple #4
0
    def mc_flush(self):
        if not hasattr(self, '_mc_flush'):
            if self._new_record:
                rid = self.rid
                if rid:
                    from model.po_question import answer_count
                    answer_count.delete(rid)
                    mc_feed_tuple.delete(rid)
            else:
                id = self.id
                mc_htm.delete(id)
                mc_feed_tuple.delete(id)
                mc_feed_po_dict.delete(id)
                if self.cid == CID_EVENT:
                    from model.event import mc_event_joiner_by_owner_id
                    mc_event_joiner_by_owner_id.delete(self.user_id)

            self._mc_flush = True
Exemple #5
0
    def reply_new(self, user, txt, state=STATE_ACTIVE):
        reply_id = super(Po, self).reply_new(user, txt, state)
        #print 'reply_id', reply_id
        if reply_id:
            user_id = user.id
            id = self.id
            mc_feed_tuple.delete(id)
            from po_pos import po_pos_state_buzz
            from buzz_reply import  mq_buzz_po_reply_new

            if not po_pos_state_buzz(user_id, self):
                from model.po_tag import po_score_incr
                po_score_incr(self, user_id, 2)

            mq_buzz_po_reply_new(user_id, reply_id, id, self.user_id)


        return reply_id