Skip to content
Myr

Switch params and example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent d8fcd42 · Browse files · 1 file+4 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−5 removed

  • other:+4 added−5 removed

1 file+4 added−5 removed

modified:flask/helpers.py+4 added-5 removed
389 unmodified lines
390391def safe_join(directory, filename):392 """Safely join `directory` and `filename`.393394 :param directory: the base directory.395 :param filename: the untrusted filename relative to that directory.396 :raises: :class:`~werkzeug.exceptions.NotFound` if the retsulting path397 would fall out of `directory`.398394 Example usage::395396 @app.route('/wiki/<path:filename>')397 def wiki_page(filename):398 filename = safe_join(app.config['WIKI_FOLDER'], filename)399 with open(filename, 'rb') as fd:400 content = fd.read() # Read and process the file content...401402 :param directory: the base directory.403 :param filename: the untrusted filename relative to that directory.404 :raises: :class:`~werkzeug.exceptions.NotFound` if the retsulting path405 would fall out of `directory`.406 """407 filename = posixpath.normpath(filename)408 for sep in _os_alt_seps:409 if sep in filename:
106 unmodified lines