Switch params and example

This commit is contained in:
Armin Ronacher 2011-04-18 23:20:24 +02:00
parent d8fcd4260e
commit e774e3a69e

View file

@ -391,11 +391,6 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
def safe_join(directory, filename):
"""Safely join `directory` and `filename`.
:param directory: the base directory.
:param filename: the untrusted filename relative to that directory.
:raises: :class:`~werkzeug.exceptions.NotFound` if the retsulting path
would fall out of `directory`.
Example usage::
@app.route('/wiki/<path:filename>')
@ -404,6 +399,10 @@ def safe_join(directory, filename):
with open(filename, 'rb') as fd:
content = fd.read() # Read and process the file content...
:param directory: the base directory.
:param filename: the untrusted filename relative to that directory.
:raises: :class:`~werkzeug.exceptions.NotFound` if the retsulting path
would fall out of `directory`.
"""
filename = posixpath.normpath(filename)
for sep in _os_alt_seps: