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')
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')
def addview(vid): video = fromcache("video_%s" % str(vid)) if not video: video = tocache("video_%s" % str(vid), treat_categories(wordpress.wpgd.getVideo(vid))[0]) if 'views' in video: video['views'] = int(video['views']) + 1 else: video['views'] = 1 removecache("video_%s" % str(vid)) tocache("video_%s" % str(vid), video) wordpress.wpgd.setVideoViews(video['views'], vid); return "ok"
def addview(vid): video = fromcache("video_%s" % str(vid)) if not video: video = tocache("video_%s" % str(vid), treat_categories(wordpress.wpgd.getVideo(vid))[0]) if 'views' in video: video['views'] = int(video['views']) + 1 else: video['views'] = 1 removecache("video_%s" % str(vid)) tocache("video_%s" % str(vid), video) wordpress.wpgd.setVideoViews(video['views'], vid) return "ok"