Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/files/<path:path>')
- def index(path=''):
- path_join = os.path.join(app.config['FILES_ROOT'], path)
- if os.path.isdir(path_join):
- folder = Folder(app.config['FILES_ROOT'], path)
- folder.read()
- return render_template('folder.html', folder=folder)
- else:
- my_file = File(app.config['FILES_ROOT'], path)
- context = my_file.apply_action(View)
- folder = Folder(app.config['FILES_ROOT'], my_file.get_path())
- if context == None:
- return render_template('file_unreadable.html', folder=folder)
- return render_template('file_view.html', text=context['text'], file=my_file, folder=folder)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement