Fix some typos in the docs
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by jgraeme · committed by Armin Ronacher · parent d09aa37 · Browse files · 8 files·+16 added−16 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+16 added−16 removed
- other:+16 added−16 removed
Provenance
- Commit
ff2786d- Tree
b2492eb- Author
jgraeme <jgraeme+git@gmail.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
d09aa37
8 files changed+16 added−16 removed
modified:docs/patterns/errorpages.rst+1 added-1 removed
3 unmodified lines4 Flask comes with a handy :func:`~flask.abort` function that aborts a5 request with an HTTP error code early. It will also provide a plain black6 and white error page for you with a basic description, but nothing fancy.7 8-Depening on the error code it is less or more likely for the user to8+Depending on the error code it is less or more likely for the user to9 actually see such an error.10 11 Common Error Codes12 ------------------65 unmodified linesmodified:docs/patterns/jquery.rst+4 added-4 removed
51 unmodified lines52 is quite simple: it's on localhost port something and directly on the root53 of that server. But what if you later decide to move your application to54 a different location? For example to ``http://example.com/myapp``? On55 the server side this never was a problem because we were using the handy56-:func:`~flask.url_for` function that did could answer that question for57-us, but if we are using jQuery we should better not hardcode the path to56+:func:`~flask.url_for` function that could answer that question for57+us, but if we are using jQuery we should not hardcode the path to58 the application but make that dynamic, so how can we do that?59 60 A simple method would be to add a script tag to our page that sets a61 global variable to the prefix to the root of the application. Something55 unmodified lines117 118 The HTML119 --------120 121-You index.html template either has to extend a `layout.html` template with121+Your index.html template either has to extend a `layout.html` template with122 jQuery loaded and the `$SCRIPT_ROOT` variable set, or do that on the top.123-Here the HTML code needed for our little application (`index.html`).123+Here's the HTML code needed for our little application (`index.html`).124 Notice that we also drop the script directly into the HTML here. It is125 usually a better idea to have that in a separate script file:126 127 .. sourcecode:: html40 unmodified linesmodified:docs/patterns/lazyloading.rst+1 added-1 removed
72 unmodified lines73 def __call__(self, *args, **kwargs):74 return self.view(*args, **kwargs)75 76 What's important here is is that `__module__` and `__name__` are properly77-set. This is used by Flask internally to figure out how to do name the77+set. This is used by Flask internally to figure out how to name the78 URL rules in case you don't provide a name for the rule yourself.79 80 Then you can define your central place to combine the views like this::81 23 unmodified linesmodified:docs/patterns/wtforms.rst+2 added-2 removed
75 unmodified lines76 how easy this is. WTForms does half the form generation for us already.77 To make it even nicer, we can write a macro that renders a field with78 label and a list of errors if there are any.79 80-Here an example `_formhelpers.html` template with such a macro:80+Here's an example `_formhelpers.html` template with such a macro:81 82 .. sourcecode:: html+jinja83 84 {% macro render_field(field) %}7 unmodified lines92 </dd>93 {% endmacro %}94 95 This macro accepts a couple of keyword arguments that are forwarded to96-WTForm's field function that renders the field for us. They keyword96+WTForm's field function that renders the field for us. The keyword97 arguments will be inserted as HTML attributes. So for example you can98 call ``render_field(form.username, class='username')`` to add a class to99 the input element. Note that WTForms returns standard Python unicode100 strings, so we have to tell Jinja2 that this data is already HTML escaped24 unmodified linesmodified:docs/extensiondev.rst+4 added-4 removed
65 unmodified lines66 sqlite3.py67 setup.py68 LICENSE69 70-Here the contents of the most important files:70+Here's the contents of the most important files:71 72 flaskext/__init__.py73 ````````````````````74 95 unmodified lines170 171 The Extension Code172 ------------------173 174-Here the contents of the `flaskext/sqlite3.py` for copy/paste::174+Here's the contents of the `flaskext/sqlite3.py` for copy/paste::175 176 from __future__ import absolute_import177 import sqlite3178 from flask import g16 unmodified lines195 def after_request(self, response):196 g.sqlite3_db.close()197 return response198 199-So here what the lines of code do:199+So here's what the lines of code do:200 201 1. the ``__future__`` import is necessary to activate absolute imports.202 This is needed because otherwise we could not call our module203 `sqlite3.py` and import the top-level `sqlite3` module which actually32 unmodified lines236 237 Initialization Functions238 ------------------------239 240-Here how the module would look like with initialization functions::240+Here's what the module would look like with initialization functions::241 242 from __future__ import absolute_import243 import sqlite3244 from flask import g83 unmodified linesmodified:docs/quickstart.rst+1 added-1 removed
229 unmodified lines230 /login?next=/231 /user/John%20Doe232 233 (This also uses the :meth:`~flask.Flask.test_request_context` method234-explained below. It basically tells flask to think we are handling a234+explained below. It basically tells Flask to think we are handling a235 request even though we are not, we are in an interactive Python shell.236 Have a look at the explanation below. :ref:`context-locals`).237 238 Why would you want to build URLs instead of hardcoding them in your507 unmodified linesmodified:docs/security.rst+2 added-2 removed
70 unmodified lines71 do stupid things without them knowing.72 73 Say you have a specific URL that, when you sent `POST` requests to will74 delete a user's profile (say `http://example.com/user/delete`). If an75-attacker now creates a page that sents a post request to that page with75+attacker now creates a page that sends a post request to that page with76 some JavaScript he just has to trick some users to that page and their77 profiles will end up being deleted.78 79 Imagine you would run Facebook with millions of concurrent users and82 unmodified lines162 163 Because it is a syntax error in JavaScript to have an object literal164 (``{...}``) toplevel an attacker could not just do a request to an165 external URL with the script tag to load up the data. So what Flask does166-is only allowing objects as toplevel elements when using166+is to only allow objects as toplevel elements when using167 :func:`~flask.jsonify`. Make sure to do the same when using an ordinary168 JSON generate function.modified:docs/upgrading.rst+1 added-1 removed
1 Upgrading to Newer Releases2 ===========================3 4 Flask itself is changing like any software is changing over time. Most of5-the changes are the nice kind, the kind where you don't have th change5+the changes are the nice kind, the kind where you don't have to change6 anything in your code to profit from a new release.7 8 However every once in a while there are changes that do require some9 changes in your code or there are changes that make it possible for you to103 unmodified lines