forked from orbit-oss/flask
Fix typos and remove unused import.
This commit is contained in:
parent
9f6bc93e4d
commit
3c821a0fa4
6 changed files with 15 additions and 14 deletions
|
|
@ -186,7 +186,7 @@ different values for each request. In a nutshell: it does the right
|
|||
thing, like it does for :class:`request` and :class:`session`.
|
||||
|
||||
.. data:: g
|
||||
|
||||
|
||||
Just store on this whatever you want. For example a database
|
||||
connection or the user that is currently logged in.
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ side.
|
|||
Note that we are using the :meth:`~werkzeug.MultiDict.get` method here
|
||||
which will never fail. If the key is missing a default value (here ``0``)
|
||||
is returned. Furthermore it can convert values to a specific type (like
|
||||
in our case `int`). This is especially handy for code that that is
|
||||
in our case `int`). This is especially handy for code that is
|
||||
triggered by a script (APIs, JavaScript etc.) because you don't need
|
||||
special error reporting in that case.
|
||||
|
||||
|
|
|
|||
|
|
@ -74,10 +74,9 @@ And this is what `views.py` would look like::
|
|||
.. admonition:: Circular Imports
|
||||
|
||||
Every Python programmer hates them, and yet we just added some:
|
||||
circular imports (That's when two module depend on each one. In this
|
||||
circular imports (That's when two modules depend on each other. In this
|
||||
case `views.py` depends on `__init__.py`). Be advised that this is a
|
||||
bad idea in general but here it is actually fine. The reason for this
|
||||
is
|
||||
bad idea in general but here it is actually fine. The reason for this is
|
||||
that we are not actually using the views in `__init__.py` and just
|
||||
ensuring the module is imported and we are doing that at the bottom of
|
||||
the file.
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@ def user_timeline(username):
|
|||
if g.user:
|
||||
followed = query_db('''select 1 from follower where
|
||||
follower.who_id = ? and follower.whom_id = ?''',
|
||||
[session['user_id'], profile_user['user_id']], one=True) is not None
|
||||
[session['user_id'], profile_user['user_id']],
|
||||
one=True) is not None
|
||||
return render_template('timeline.html', messages=query_db('''
|
||||
select message.*, user.* from message, user where
|
||||
user.user_id = message.author_id and user.user_id = ?
|
||||
|
|
@ -230,7 +231,7 @@ def register():
|
|||
|
||||
@app.route('/logout')
|
||||
def logout():
|
||||
"""Logs the user out"""
|
||||
"""Logs the user out."""
|
||||
flash('You were logged out')
|
||||
session.pop('user_id', None)
|
||||
return redirect(url_for('public_timeline'))
|
||||
|
|
|
|||
9
flask.py
9
flask.py
|
|
@ -10,7 +10,6 @@
|
|||
:license: BSD, see LICENSE for more details.
|
||||
"""
|
||||
from __future__ import with_statement
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
@ -261,7 +260,7 @@ def _default_template_ctx_processor():
|
|||
|
||||
|
||||
def _assert_have_json():
|
||||
"""Helper function that fails if JSON is unavailable"""
|
||||
"""Helper function that fails if JSON is unavailable."""
|
||||
if not json_available:
|
||||
raise RuntimeError('simplejson not installed')
|
||||
|
||||
|
|
@ -517,7 +516,7 @@ class Flask(object):
|
|||
|
||||
def add_url_rule(self, rule, endpoint, view_func=None, **options):
|
||||
"""Connects a URL rule. Works exactly like the :meth:`route`
|
||||
decorator. If a view_func is provided it will be registered with the
|
||||
decorator. If a view_func is provided it will be registered with the
|
||||
endpoint.
|
||||
|
||||
Basically this example::
|
||||
|
|
@ -544,7 +543,7 @@ class Flask(object):
|
|||
:param endpoint: the endpoint for the registered URL rule. Flask
|
||||
itself assumes the name of the view function as
|
||||
endpoint
|
||||
:param view_func: the function to call when servicing a request to the
|
||||
:param view_func: the function to call when serving a request to the
|
||||
provided endpoint
|
||||
:param options: the options to be forwarded to the underlying
|
||||
:class:`~werkzeug.routing.Rule` object
|
||||
|
|
@ -798,7 +797,7 @@ class Flask(object):
|
|||
return self.request_context(create_environ(*args, **kwargs))
|
||||
|
||||
def __call__(self, environ, start_response):
|
||||
"""Shortcut for :attr:`wsgi_app`"""
|
||||
"""Shortcut for :attr:`wsgi_app`."""
|
||||
return self.wsgi_app(environ, start_response)
|
||||
|
||||
|
||||
|
|
|
|||
6
setup.py
6
setup.py
|
|
@ -34,7 +34,8 @@ Links
|
|||
|
||||
* `website <http://flask.pocoo.org/>`_
|
||||
* `documentation <http://flask.pocoo.org/docs/>`_
|
||||
* `development version <http://github.com/mitsuhiko/flask/zipball/master#egg=Flask-dev>`_
|
||||
* `development version
|
||||
<http://github.com/mitsuhiko/flask/zipball/master#egg=Flask-dev>`_
|
||||
|
||||
"""
|
||||
from setuptools import setup
|
||||
|
|
@ -47,7 +48,8 @@ setup(
|
|||
license='BSD',
|
||||
author='Armin Ronacher',
|
||||
author_email='armin.ronacher@active-4.com',
|
||||
description='A microframework based on Werkzeug, Jinja2 and good intentions',
|
||||
description='A microframework based on Werkzeug, Jinja2 '
|
||||
'and good intentions',
|
||||
long_description=__doc__,
|
||||
py_modules=['flask'],
|
||||
zip_safe=False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue