Skip to content
Myr

remove unnecessary form action attributes

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

authored by David Lord · committed by David Lord · parent d8c39f4 · Browse files · 4 files+7 added−7 removed
This commit

State

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

Diff stats

4 files+7 added−7 removed

  • other:+7 added−7 removed

4 files+7 added−7 removed

modified:docs/patterns/fileuploads.rst+4 added-4 removed
69 unmodified lines
70 return '''71 <!doctype html>72 <title>Upload new File</title>73 <h1>Upload new File</h1>74 <form action="" method=post enctype=multipart/form-data>74 <form method=post enctype=multipart/form-data>75 <p><input type=file name=file>76 <input type=submit value=Upload>77 </form>78 '''
24 unmodified lines
103104 >>> secure_filename('../../../../home/username/.bashrc')105 'home_username_.bashrc'106107Now one last thing is missing: the serving of the uploaded files. In the 108:func:`upload_file()` we redirect the user to 109``url_for('uploaded_file', filename=filename)``, that is, ``/uploads/filename``. 107Now one last thing is missing: the serving of the uploaded files. In the108:func:`upload_file()` we redirect the user to109``url_for('uploaded_file', filename=filename)``, that is, ``/uploads/filename``.110So we write the :func:`uploaded_file` function to return the file of that name. As111of Flask 0.5 we can use a function that does that for us::112113 from flask import send_from_directory
71 unmodified lines
modified:docs/patterns/flashing.rst+1 added-1 removed
76 unmodified lines
77 <h1>Login</h1>78 {% if error %}79 <p class=error><strong>Error:</strong> {{ error }}80 {% endif %}81 <form action="" method=post>81 <form method=post>82 <dl>83 <dt>Username:84 <dd><input type=text name=username value="{{85 request.form.username }}">
65 unmodified lines
modified:docs/patterns/wtforms.rst+1 added-1 removed
106 unmodified lines
107108.. sourcecode:: html+jinja109110 {% from "_formhelpers.html" import render_field %}111 <form method=post action="/register">111 <form method=post>112 <dl>113 {{ render_field(form.username) }}114 {{ render_field(form.email) }}115 {{ render_field(form.password) }}
11 unmodified lines
modified:docs/quickstart.rst+1 added-1 removed
782 unmodified lines
783 if request.method == 'POST':784 session['username'] = request.form['username']785 return redirect(url_for('index'))786 return '''787 <form action="" method="post">787 <form method="post">788 <p><input type=text name=username>789 <p><input type=submit value=Login>790 </form>791 '''
103 unmodified lines