More typo fixes.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Georg Brandl · committed by Armin Ronacher · parent 63caf6e · Browse files · 9 files·+24 added−24 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+24 added−24 removed
- other:+24 added−24 removed
Provenance
- Commit
a224fec- Tree
97148b9- Author
Georg Brandl <georg@python.org>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
63caf6e
9 files changed+24 added−24 removed
modified:docs/deploying/mod_wsgi.rst+4 added-4 removed
17 unmodified lines18 19 If you don't have `mod_wsgi` installed yet you have to either install it using20 a package manager or compile it yourself.21 22-The mod_wsgi `installation instructions`_ cover source installations on UNIX 22+The mod_wsgi `installation instructions`_ cover source installations on UNIX23 systems.24 25-If you are using ubuntu / debian you can apt-get it and activate it as follows:25+If you are using Ubuntu/Debian you can apt-get it and activate it as follows:26 27 .. sourcecode:: text28 29 # apt-get install libapache2-mod-wsgi65 unmodified lines95 --------------96 97 If your application does not run, follow this guide to troubleshoot:98 99-**Problem:** Application does not run, errorlog shows SystemExit ignored99+**Problem:** application does not run, errorlog shows SystemExit ignored100 You have a ``app.run()`` call in your application file that is not101 guarded by an ``if __name__ == '__main__':`` condition. Either remove102 that :meth:`~flask.Flask.run` call from the file and move it into a103 separate `run.py` file or put it into such an if block.25 unmodified lines129 site-packages folder. Please be aware that this does not work,130 instead you either have to put the folder into the pythonpath the file131 is stored in, or convert your application into a package.132 133- The reason for this is that for non-installed Packages, the module133+ The reason for this is that for non-installed packages, the module134 filename is used to locate the resources and for symlinks the wrong135 filename is picked up.modified:docs/tutorial/css.rst+1 added-1 removed
12 unmodified lines13 a, h1, h2 { color: #377BA8; }14 h1, h2 { font-family: 'Georgia', serif; margin: 0; }15 h1 { border-bottom: 2px solid #eee; }16 h2 { font-size: 1.2em; }17- 17+18 .page { margin: 2em auto; width: 35em; border: 5px solid #ccc;19 padding: 0.8em; background: white; }20 .entries { list-style: none; margin: 0; padding: 0; }21 .entries li { margin: 0.8em 1.2em; }10 unmodified linesmodified:docs/tutorial/dbinit.rst+1 added-1 removed
29 unmodified lines30 31 Next we can create a function called `init_db` that initializes the32 database. For this we can use the `connect_db` function we defined33 earlier. Just add that function below the `connect_db` function::34- 34+35 def init_db():36 with closing(connect_db()) as db:37 with app.open_resource('schema.sql') as f:38 db.cursor().executescript(f.read())29 unmodified linesmodified:docs/tutorial/testing.rst+1 added-1 removed
1 .. _tutorial-testing:2 3 Bonus: Testing the Application4-===============================4+==============================5 6 Now that you have finished the application and everything works as7 expected, it's probably not a good idea to add automated tests to simplify8 modifications in the future. The application above is used as a basic2 unmodified linesmodified:docs/api.rst+1 added-1 removed
67 unmodified lines68 If the incoming form data was not encoded with a known mimetype69 the data is stored unmodified in this stream for consumption. Most70 of the time it is a better idea to use :attr:`data` which will give71 you that data as a string. The stream only returns the data once.72- 72+73 .. attribute:: data74 75 Contains the incoming request data as string in case it came with76 a mimetype Flask does not handle.216 unmodified linesmodified:docs/design.rst+3 added-3 removed
88 unmodified lines89 90 But that's about where similarities end. Jinja2 for example has an91 extensive filter system, a certain way to do template inheritance, support92 for reusable blocks (macros) that can be used from inside templates and93-also from Python code, uses unicode for all operations, supports93+also from Python code, uses Unicode for all operations, supports94 iterative template rendering, configurable syntax and more. On the other95 hand an engine like Genshi is based on XML stream evaluation, template96 inheritance by taking the availability of XPath into account and more.97 Mako on the other hand treats templates similar to Python modules.98 99-When it comes to connecting a template engine with an application or 99+When it comes to connecting a template engine with an application or100 framework there is more than just rendering templates. For instance,101-Flask uses Jinja2's extensive autoescaping support. Also it provides 101+Flask uses Jinja2's extensive autoescaping support. Also it provides102 ways to access macros from Jinja2 templates.103 104 A template abstraction layer that would not take the unique features of105 the template engines away is a science on its own and a too large42 unmodified linesmodified:docs/installation.rst+1 added-1 removed
27 unmodified lines28 you have shell access. So first: what does virtualenv do? If you are29 like me and you like Python, chances are you want to use it for another30 project as well. Now the more projects you have, the more likely it is31 that you will be working with different versions of Python itself or at32-least an individual library. Because let's face it: quite often libraries 32+least an individual library. Because let's face it: quite often libraries33 break backwards compatibility and it's unlikely that your application will34 not have any dependencies, that just won't happen. So virtualenv to the35 rescue!36 139 unmodified linesmodified:docs/quickstart.rst+9 added-9 removed
207 unmodified lines208 >>> from flask import Flask, url_for209 >>> app = Flask(__name__)210 >>> @app.route('/')211 ... def index(): pass212-... 212+...213 >>> @app.route('/login')214 ... def login(): pass215-... 215+...216 >>> @app.route('/user/<username>')217 ... def profile(username): pass218-... 218+...219 >>> with app.test_request_context():220 ... print url_for('index')221 ... print url_for('login')222 ... print url_for('login', next='/')223 ... print url_for('profile', username='John Doe')224-... 224+...225 /226 /login227 /login?next=/228 /user/John%20Doe8 unmodified lines237 238 1. reversing is often more descriptive than hardcoding the URLs. Also and239 more importantly you can change URLs in one go without having to change240 the URLs all over the place.241-2. URL building will handle escaping of special characters and unicode241+2. URL building will handle escaping of special characters and Unicode242 data transparently for you, you don't have to deal with that.243 3. If your application is placed outside the URL root (so say in244 ``/myapplication`` instead of ``/``), :func:`~flask.url_for` will245 handle that properly for you.108 unmodified lines354 application is a module, that folder is next to that module, if it's a355 package it's actually inside your package:356 357 **Case 1**: a module::358- 358+359 /application.py360 /templates361 /hello.html362 299 unmodified lines662 .. admonition:: How to generate good Secret Keys663 664 The problem with random is that it's hard to judge what random is. And665 a secret key should be as random as possible. Your operating system666- has ways to generate pretty random stuff based on a cryptographical666+ has ways to generate pretty random stuff based on a cryptographic667 random generator which can be used to get such a key:668 669 >>> import os670 >>> os.urandom(24)35 unmodified lines706 707 Here are some example log calls::708 709 app.logger.debug('A value for debugging')710- app.logger.warning('A warning ocurred (%d apples)', 42)711- app.logger.error('An error occoured')710+ app.logger.warning('A warning occurred (%d apples)', 42)711+ app.logger.error('An error occurred')712 713 The attached :attr:`~flask.Flask.logger` is a standard logging714 :class:`~logging.Logger`, so head over to the official stdlib715 documentation for more information.modified:docs/testing.rst+3 added-3 removed
68 unmodified lines69 low-level file handle and a random file name, the latter we use as70 database name. We just have to keep the `db_fd` around so that we can use71 the :func:`os.close` function to close the file.72 73-If we now run that testsuite, we should see the following output::73+If we now run that test suite, we should see the following output::74 75 $ python flaskr_tests.py76 77 ----------------------------------------------------------------------102 unmodified lines180 which is the intended behavior.181 182 Running that should now give us three passing tests::183 184- $ python flaskr_tests.py 184+ $ python flaskr_tests.py185 ...186 ----------------------------------------------------------------------187 Ran 3 tests in 0.332s188- 188+189 OK190 191 For more complex tests with headers and status codes, check out the192 `MiniTwit Example`_ from the sources. That one contains a larger test28 unmodified lines