From 3c821a0fa45082bcec73dfb08662fb1de5263c48 Mon Sep 17 00:00:00 2001 From: florentx Date: Tue, 20 Apr 2010 18:40:58 +0200 Subject: [PATCH] Fix typos and remove unused import. --- docs/api.rst | 2 +- docs/patterns/jquery.rst | 2 +- docs/patterns/packages.rst | 5 ++--- examples/minitwit/minitwit.py | 5 +++-- flask.py | 9 ++++----- setup.py | 6 ++++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 122da451..d285dbfd 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -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. diff --git a/docs/patterns/jquery.rst b/docs/patterns/jquery.rst index 32eb6f04..f087e6f0 100644 --- a/docs/patterns/jquery.rst +++ b/docs/patterns/jquery.rst @@ -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. diff --git a/docs/patterns/packages.rst b/docs/patterns/packages.rst index 5e14625b..4d54e49c 100644 --- a/docs/patterns/packages.rst +++ b/docs/patterns/packages.rst @@ -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. diff --git a/examples/minitwit/minitwit.py b/examples/minitwit/minitwit.py index ef0c7673..07ffe4c7 100644 --- a/examples/minitwit/minitwit.py +++ b/examples/minitwit/minitwit.py @@ -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')) diff --git a/flask.py b/flask.py index cb638e70..e84519cd 100644 --- a/flask.py +++ b/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) diff --git a/setup.py b/setup.py index 1742542d..ae68c49e 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,8 @@ Links * `website `_ * `documentation `_ -* `development version `_ +* `development version + `_ """ 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,