Ejemplo n.º 1
0
def new_comment():
    """Posts new comments to the blog"""
    print "/new_comment/"
    if not is_authenticated():
        resp = make_response(
            dumps({
                'status': 'error',
                'msg': _(u'User not authenticated'),
                'redirectTo': url_for('auth.login')
            }))
        # if request.form['content']:
        #     resp.set_cookie('live_comment_save', request.form['content'].replace('\n','<br/>') )
        return resp

    try:
        nao_exibir_nome = request.form['nao_exibir_nome']
    except:
        nao_exibir_nome = ""

    try:
        post_id = request.form['comentar_em']
    except:
        post_id = request.form['post_id']

    try:
        wordpress.newComment(username=session['username'],
                             password=session['password'],
                             post_id=post_id,
                             content=request.form['content'],
                             nao_exibir_nome=nao_exibir_nome)
        removecache("comentarios%s" % str(post_id))
        return msg.ok(_(u'Thank you. Your comment was successfuly sent'))
    except xmlrpclib.Fault, err:
        return msg.error(_(err.faultString), code='CommentError')
Ejemplo n.º 2
0
def new_comment():
    """Posts new comments to the blog"""
    print "/new_comment/"
    if not is_authenticated():
        resp = make_response(dumps({
            'status': 'error',
            'msg': _(u'User not authenticated'),
            'redirectTo': url_for('auth.login')
        }))
        # if request.form['content']:
        #     resp.set_cookie('live_comment_save', request.form['content'].replace('\n','<br/>') )
        return resp

    try:
        nao_exibir_nome = request.form['nao_exibir_nome']
    except:
        nao_exibir_nome = ""

    try:
        post_id = request.form['comentar_em']
    except:
        post_id = request.form['post_id']

    try:
        wordpress.newComment(
            username=session['username'],
            password=session['password'],
            post_id=post_id,
            content=request.form['content'],
            nao_exibir_nome=nao_exibir_nome
        )
        removecache("comentarios%s" % str(post_id))
        return msg.ok(_(u'Thank you. Your comment was successfuly sent'))
    except xmlrpclib.Fault, err:
        return msg.error(_(err.faultString), code='CommentError')
Ejemplo n.º 3
0
def new_contribution():
    """Posts new contributions on the page 'conselho-comunicacao' """

    try:
        mostrar_nome = request.form['mostrar_nome']
    except KeyError:
        mostrar_nome = 'N'

    if not is_authenticated():
        return msg.error(_(u'User not authenticated'))
    try:
        print "\n\nMOSTRAR NOME!", mostrar_nome
        cid = wordpress.newComment(
            username=session['username'],
            password=session['password'],
            post_id=request.form['post_id'],
            content=request.form['content1'] or request.form['content2'],
            categoria_sugestao=request.form['categoria_sugestao'],
            mostrar_nome=mostrar_nome)
        return msg.ok(_(u'Thank you. Your contribution was successfuly sent.'))
    except xmlrpclib.Fault, err:
        return msg.error(_(err.faultString), code='CommentError')
Ejemplo n.º 4
0
def new_contribution():
    """Posts new contributions on the page 'conselho-comunicacao' """

    try:
        mostrar_nome = request.form['mostrar_nome']
    except KeyError :
        mostrar_nome = 'N'

    if not is_authenticated():
        return msg.error(_(u'User not authenticated'))
    try:
        print "\n\nMOSTRAR NOME!", mostrar_nome
        cid = wordpress.newComment(
            username=session['username'],
            password=session['password'],
            post_id=request.form['post_id'],
            content=request.form['content1'] or request.form['content2'],
            categoria_sugestao=request.form['categoria_sugestao'],
            mostrar_nome=mostrar_nome
        )
        return msg.ok(_(u'Thank you. Your contribution was successfuly sent.'))
    except xmlrpclib.Fault, err:
        return msg.error(_(err.faultString), code='CommentError')