コード例 #1
0
def sync_delete(b, f, h):
    a, c, q, t = getfspost(b, f)
    post = query_postid(b, f)
    if not post :
        logger.error('Sync delete noexists: boardname=%s filename=%s [%s]',
                     b, f, h)
        return
    elif post.has_key('tid') :
        deltopic(a['owner'], post.tid)
    elif post.has_key('rid') :
        delreply(a['owner'], post.rid)
コード例 #2
0
def sync_reply(b, f, f0, h):
    a, c, q, t = getfspost(b, f)
    post = query_postid(b, f0)
    g._filename = f
    if not post :
        logger.error('Sync reply noexists: boardname=%s filename=%s [%s]',
                     b, f0, h)
        return
    elif post.has_key('tid') :
        reply(userid=a['owner'], tid=post.tid, content=c.decode('gbk', 'ignore'), fromaddr=h)
    elif post.has_key('rid') :
        comment(userid=a['owner'], replyid=post.rid, content=c.decode('gbk', 'ignore'), fromaddr=h)
コード例 #3
0
def sync_updatepost(b, f, h):
    a, c, q, t = getfspost(b, f)
    post = query_postid(b, f)
    if not post :
        logger.error('Sync update noexists: boardname=%s filename=%s [%s]',
                     b, f, h)
        return
    elif post.has_key('tid') :
        update_topic(a['owner'], post.tid,
                     a['title'].decode('gbk', 'ignore'),
                     c.decode('gbk', 'ignore'))
    elif post.has_key('rid') :
        update_reply(a['owner'], reply.rid, c.decode('gbk', 'ignore'))
コード例 #4
0
def update2fs_reply(userid, rid, content, **ps) :
    db = getconn()
    reply = db.get(u"SELECT tid, oldfilename FROM herzog_reply"
                   "  WHERE rid=%s", rid)
    if not reply :
        raise HZActionError('No such reply')
    topic = db.get(u"SELECT boardname FROM herzog_topic"
                   "  WHERE tid=%s", reply.tid)
    if not topic :
        raise HZActionError("No such topic")
    header, _, quote, tail = getfspost(topic.boardname,
                                       reply.oldfilename)
    r = getclient().do_edit(board=topic.boardname,
                            title=header['title'].decode('gbk').encode('utf8'),
                            text=content.encode('utf8'),
                            file=reply.oldfilename)
    if r.has_key('error') :
        raise HZActionError(r['emsg'])
    return True
コード例 #5
0
def sync_newtopic(b, f, h):
    a, c, q, t = getfspost(b, f)
    g._filename = f
    topic(userid=a['owner'], boardname=b,
          title=a['title'].decode('gbk', 'ignore'),
          content=c.decode('gbk', 'ignore'), fromaddr=h)
コード例 #6
0
def async_cross(b, f, h):
    a, c, q, t = getfspost(b, f)
    g._filename = f
    topic(a['owner'], b, a['title'].decode('gbk', 'ignore'),
          c.decode('gbk', 'ignore'), h)