예제 #1
0
def delete_media():
    media = Media.get_by_filename(request.json['id'][1:])
    if not media:
        return jsonify(['Invalid media ID.'], _status_code=400)
    if not current_user.is_authenticated() or \
       (not media.is_owner(current_user) and not current_user.is_admin):
       return jsonify(['Invalid access.'], _status_code=400)
    media.delete()
    return ''
예제 #2
0
def get_media():
    last = Media.get_by_filename(request.args['after'][1:])
    return jsonify(Media.get_latest_after(last))