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)
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)
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)