예제 #1
0
    def test_get_comment(self):
        with db.connect_db() as conn:
            db_add(conn, tdc.TEST_ROWS['owners'])
            db_add(conn, tdc.TEST_ROWS['projects'])
            db_add(conn, tdc.TEST_ROWS['comments'])

            result = db.get_comment(conn, tdc.MOCK_COMMENT_UUID_12)
            self.assertEqual(result[0][4], "Owner 1, project 1, comment 2")
예제 #2
0
파일: bot.py 프로젝트: renatick321/bot
def payment(message):
    if message.text == "🥝 Киви":
        print(1)
        comment = db.get_comment()
        print(2)
        bot.send_message(message.chat.id, "➖➖➖➖➖➖➖➖➖➖\nИнформация об оплате\n🥝 QIWI-кошелек: +{}\n📝 Комментарий к переводу: ```{}``` \n➖➖➖➖➖➖➖➖➖➖\n\nВнимание\nПереводите ту сумму, на которую хотите пополнить баланс!\nЗаполняйте номер телефона и комментарий при переводе внимательно!\nАдминистрация не несет ответственности за ошибочный перевод, возврата в данном случае не будет!\nПосле перевода нажмите кнопку 'Проверить оплату'!\n➖➖➖➖➖➖➖➖➖➖".format(qiwi.NUMBER, comment), parse_mode="Markdown", reply_markup=tomenu())
        bot.send_message(message.chat.id, "Нажмите для проверки оплаты", reply_markup=cash_check(comment))
    elif message.text == '↪ В главное меню ↩':
        bot.send_message(message.chat.id, "Вы в главном меню", reply_markup=menu())
    else:
        bot.send_message(message.chat.id, "Воспользуйтесь клавиатурой", reply_markup=menu())
예제 #3
0
파일: index.py 프로젝트: ab/blag
 def delete_comment(self, comment_id=None, submit=None):
     if cherrypy.request.method.lower() != "post":
         error("Cannot service non-post requests.")
     author = get_author()
     if author is None:
         error("You need to be logged in to delete comments.")
     comment = db.get_comment(comment_id)
     if comment is None:
         error("Invalid comment id.")
     post = db.get_post(comment["post_id"])
     if post["author_id"] == author["id"]:
         if not db.del_comment(comment_id):
             error("Failed to delete comment.")
     raise cherrypy.HTTPRedirect("/entry/%s" % post["id"])
예제 #4
0
파일: views.py 프로젝트: tomik/honey
def delete_comment():
    """Deletes comment identified by id in post data. Requires login. Called via ajax."""
    username = session["username"]
    user = db.get_user_by_username(username)
    if not user:
        app.logger.warning("comment without user")
        abort(500)
    comment_id = request.form.get("comment_id", None)
    comment = db.get_comment(comment_id)
    if not comment:
        app.logger.warning("no comment for given id %s" % comment_id)
        abort(500)
    can_delete_comment = comment.is_owner(user)
    if not can_delete_comment:
        app.logger.warning("User %s tried to delete comment %s without permissions." % (user["_id"], comment["_id"]))
        abort(500)
    db.delete_comment(comment_id)
    return jsonify(err=None, comment_id = comment_id)
예제 #5
0
파일: views.py 프로젝트: tomik/honey
def view_comment(comment_id):
    """Views existing game on given comment."""
    comment = db.get_comment(comment_id)
    if not comment:
        abort(404)
    return _view_game(comment.game_id, comment.path)