def notice_reply():
    pre_pos = kv_int.get(KV_REPLY_NUM)

    #print pre_pos; pre_pos = 0

    c = Reply.raw_sql( 'select max(id) from reply where cid = %s', CID_NOTE)

    pos = c.fetchone()[0]

    if pos > pre_pos:
        d = defaultdict(set)

        for i in Reply.where(cid=CID_NOTE).where( 'id>%s and id<=%s', pre_pos, pos):
            po_id = i.rid
            user_id = i.user_id
            d[po_id].add(user_id)

        for po_id, li in d.iteritems():
            reply_notice_mail(po_id, li)

        kv_int.set(KV_REPLY_NUM, pos)
Example #2
0
def notice_reply():
    pre_pos = kv_int.get(KV_REPLY_NUM)

    #print pre_pos; pre_pos = 0

    c = Reply.raw_sql('select max(id) from reply where cid = %s', CID_NOTE)

    pos = c.fetchone()[0]

    if pos > pre_pos:
        d = defaultdict(set)

        for i in Reply.where(cid=CID_NOTE).where('id>%s and id<=%s', pre_pos,
                                                 pos):
            po_id = i.rid
            user_id = i.user_id
            d[po_id].add(user_id)

        for po_id, li in d.iteritems():
            reply_notice_mail(po_id, li)

        kv_int.set(KV_REPLY_NUM, pos)