Skip to content
Myr

Merge pull request #257 from jfinkels/master

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

Pronoun gender fixes in documentation

authored by Armin Ronacher · committed by Armin Ronacher · parents 8e928a2, 12761bd · Browse files · 8 files+15 added−15 removed
This commit

State

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

Diff stats

8 files+15 added−15 removed

  • other:+15 added−15 removed

8 files+15 added−15 removed

modified:docs/patterns/errorpages.rst+2 added-2 removed
22 unmodified lines
2324*403 Forbidden*25 If you have some kind of access control on your website, you will have26 to send a 403 code for disallowed resources. So make sure the user27 is not lost when he tries to access a resource he cannot access.27 is not lost when he or she tries to access a forbidden resource.2829*410 Gone*30 Did you know that there the "404 Not Found" has a brother named "41031 Gone"? Few people actually implement that, but the idea is that32 resources that previously existed and got deleted answer with 41033 instead of 404. If you are not deleting documents permanently from34 the database but just mark them as deleted, do the user a favour and35 use the 410 code instead and display a message that what he was35 use the 410 code instead and display a message that what he or she was36 looking for was deleted for all eternity.3738*500 Internal Server Error*39 Usually happens on programming errors or if the server is overloaded.
38 unmodified lines
modified:docs/patterns/fileuploads.rst+3 added-3 removed
87 unmodified lines
88 filename = "../../../../home/username/.bashrc"8990 Assuming the number of ``../`` is correct and you would join this with91 the `UPLOAD_FOLDER` the user might have the ability to modify a file on92 the server's filesystem he should not modify. This does require some92 the server's filesystem he or she should not modify. This does require some93 knowledge about how the application looks like, but trust me, hackers94 are patient :)9596 Now let's look how that function works:
57 unmodified lines
154155A while ago many developers had the idea to read the incoming file in156small chunks and store the upload progress in the database to be able to157poll the progress with JavaScript from the client. Long story short: the158client asks the server every 5 seconds how much he has transmitted159already. Do you realize the irony? The client is asking for something he158client asks the server every 5 seconds how much it has transmitted159already. Do you realize the irony? The client is asking for something it160should already know.161162Now there are better solutions to that work faster and more reliable. The163web changed a lot lately and you can use HTML5, Java, Silverlight or Flash
17 unmodified lines
modified:docs/patterns/flashing.rst+1 added-1 removed
2 unmodified lines
3Message Flashing4================56Good applications and user interfaces are all about feedback. If the user7does not get enough feedback he will probably end up hating the7does not get enough feedback he or she will probably end up hating the8application. Flask provides a really simple way to give feedback to a9user with the flashing system. The flashing system basically makes it10possible to record a message at the end of a request and access it next11request and only next request. This is usually combined with a layout
108 unmodified lines
modified:docs/patterns/viewdecorators.rst+1 added-1 removed
6 unmodified lines
7functionality to one or more functions. The :meth:`~flask.Flask.route`8decorator is the one you probably used already. But there are use cases9for implementing your own decorator. For instance, imagine you have a10view that should only be used by people that are logged in to. If a user11goes to the site and is not logged in, he should be redirected to the11goes to the site and is not logged in, he or she should be redirected to the12login page. This is a good example of a use case where a decorator is an13excellent solution.1415Login Required Decorator
153 unmodified lines
modified:docs/tutorial/views.rst+1 added-1 removed
27 unmodified lines
2829Add New Entry30-------------3132This view lets the user add new entries if he's logged in. This only32This view lets the user add new entries if he or she is logged in. This only33responds to `POST` requests, the actual form is shown on the34`show_entries` page. If everything worked out well we will35:func:`~flask.flash` an information message to the next request and36redirect back to the `show_entries` page::
62 unmodified lines
modified:docs/api.rst+2 added-2 removed
154 unmodified lines
155If you have the :attr:`Flask.secret_key` set you can use sessions in Flask156applications. A session basically makes it possible to remember157information from one request to another. The way Flask does this is by158using a signed cookie. So the user can look at the session contents, but159not modify it unless he knows the secret key, so make sure to set that to160something complex and unguessable.159not modify it unless he or she knows the secret key, so make sure to set that160to something complex and unguessable.161162To access the current session you can use the :class:`session` object:163164.. class:: session
281 unmodified lines
modified:docs/quickstart.rst+4 added-4 removed
124 unmodified lines
125Modern web applications have beautiful URLs. This helps people remember126the URLs which is especially handy for applications that are used from127mobile devices with slower network connections. If the user can directly128go to the desired page without having to hit the index page it is more129likely he will like the page and come back next time.129likely he or she will like the page and come back next time.130131As you have seen above, the :meth:`~flask.Flask.route` decorator is used132to bind a function to a URL. Here are some basic examples::133
480 unmodified lines
614 abort(401)615 this_is_never_executed()616617This is a rather pointless example because a user will be redirected from618the index to a page he cannot access (401 means access denied) but it618the index to a page he or she cannot access (401 means access denied) but it619shows how that works.620621By default a black and white error page is shown for each error code. If622you want to customize the error page, you can use the
18 unmodified lines
641:class:`~flask.session` that allows you to store information specific to a642user from one request to the next. This is implemented on top of cookies643for you and signs the cookies cryptographically. What this means is that644the user could look at the contents of your cookie but not modify it,645unless he knows the secret key used for signing.645unless he or she knows the secret key used for signing.646647In order to use sessions you have to set a secret key. Here is how648sessions work::649
47 unmodified lines
697Message Flashing698----------------699700Good applications and user interfaces are all about feedback. If the user701does not get enough feedback he will probably end up hating the701does not get enough feedback he or she will probably end up hating the702application. Flask provides a really simple way to give feedback to a703user with the flashing system. The flashing system basically makes it704possible to record a message at the end of a request and access it next705request and only next request. This is usually combined with a layout
45 unmodified lines
modified:docs/security.rst+1 added-1 removed
71 unmodified lines
7273Say you have a specific URL that, when you sent `POST` requests to will74delete a user's profile (say `http://example.com/user/delete`). If an75attacker now creates a page that sends a post request to that page with76some JavaScript he just has to trick some users to load that page and76some JavaScript he or she just has to trick some users to load that page and77their profiles will end up being deleted.7879Imagine you were to run Facebook with millions of concurrent users and80someone would send out links to images of little kittens. When users
95 unmodified lines