Fix some typos in the docs
This commit is contained in:
parent
d09aa37650
commit
ff2786d8af
8 changed files with 16 additions and 16 deletions
|
|
@ -5,7 +5,7 @@ Flask comes with a handy :func:`~flask.abort` function that aborts a
|
|||
request with an HTTP error code early. It will also provide a plain black
|
||||
and white error page for you with a basic description, but nothing fancy.
|
||||
|
||||
Depening on the error code it is less or more likely for the user to
|
||||
Depending on the error code it is less or more likely for the user to
|
||||
actually see such an error.
|
||||
|
||||
Common Error Codes
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ is quite simple: it's on localhost port something and directly on the root
|
|||
of that server. But what if you later decide to move your application to
|
||||
a different location? For example to ``http://example.com/myapp``? On
|
||||
the server side this never was a problem because we were using the handy
|
||||
:func:`~flask.url_for` function that did could answer that question for
|
||||
us, but if we are using jQuery we should better not hardcode the path to
|
||||
:func:`~flask.url_for` function that could answer that question for
|
||||
us, but if we are using jQuery we should not hardcode the path to
|
||||
the application but make that dynamic, so how can we do that?
|
||||
|
||||
A simple method would be to add a script tag to our page that sets a
|
||||
|
|
@ -118,9 +118,9 @@ special error reporting in that case.
|
|||
The HTML
|
||||
--------
|
||||
|
||||
You index.html template either has to extend a `layout.html` template with
|
||||
Your index.html template either has to extend a `layout.html` template with
|
||||
jQuery loaded and the `$SCRIPT_ROOT` variable set, or do that on the top.
|
||||
Here the HTML code needed for our little application (`index.html`).
|
||||
Here's the HTML code needed for our little application (`index.html`).
|
||||
Notice that we also drop the script directly into the HTML here. It is
|
||||
usually a better idea to have that in a separate script file:
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ function but internally imports the real function on first use::
|
|||
return self.view(*args, **kwargs)
|
||||
|
||||
What's important here is is that `__module__` and `__name__` are properly
|
||||
set. This is used by Flask internally to figure out how to do name the
|
||||
set. This is used by Flask internally to figure out how to name the
|
||||
URL rules in case you don't provide a name for the rule yourself.
|
||||
|
||||
Then you can define your central place to combine the views like this::
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ how easy this is. WTForms does half the form generation for us already.
|
|||
To make it even nicer, we can write a macro that renders a field with
|
||||
label and a list of errors if there are any.
|
||||
|
||||
Here an example `_formhelpers.html` template with such a macro:
|
||||
Here's an example `_formhelpers.html` template with such a macro:
|
||||
|
||||
.. sourcecode:: html+jinja
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ Here an example `_formhelpers.html` template with such a macro:
|
|||
{% endmacro %}
|
||||
|
||||
This macro accepts a couple of keyword arguments that are forwarded to
|
||||
WTForm's field function that renders the field for us. They keyword
|
||||
WTForm's field function that renders the field for us. The keyword
|
||||
arguments will be inserted as HTML attributes. So for example you can
|
||||
call ``render_field(form.username, class='username')`` to add a class to
|
||||
the input element. Note that WTForms returns standard Python unicode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue