示例#1
0
文件: home.py 项目: note35/TC
def delmsg(mid):
    if request.method == 'GET':
        try:
            message = database.get_msg_by_id(mid)
            if message['user'] == session['logged_in']:
                if 'image' in message:
                    s3.s3_delete(message['image'])
                database.del_msg(mid, session['logged_in'])
            else:
                current_app.logger.warn(str(session['logged_in'])+' try to delete illegal message')
            flash (flash_config.get('home', 'delmsg_success'))
            return redirect(url_for('home.home'))
        except TypeError as ex:
            abort(403)
示例#2
0
def delmsg(mid):
    if request.method == 'GET':
        try:
            message = database.get_msg_by_id(mid)
            if message['user'] == session['logged_in']:
                if 'image' in message:
                    s3.s3_delete(message['image'])
                database.del_msg(mid, session['logged_in'])
            else:
                current_app.logger.warn(
                    str(session['logged_in']) +
                    ' try to delete illegal message')
            flash(flash_config.get('home', 'delmsg_success'))
            return redirect(url_for('home.home'))
        except TypeError as ex:
            abort(403)
示例#3
0
文件: test_s3_lib.py 项目: note35/TC
 def test002_delete(self):
     assert s3.s3_get(self.image_name)
     s3.s3_delete(self.image_name)
     assert not s3.s3_get(self.image_name)
示例#4
0
 def test002_delete(self):
     assert s3.s3_get(self.image_name)
     s3.s3_delete(self.image_name)
     assert not s3.s3_get(self.image_name)