From 6955678e9714975e35760671c519f6c67c5c54ff Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Thu, 28 Mar 2013 11:38:20 +0100 Subject: [PATCH] Document the Flask adapter --- README.rst | 3 ++- doc/changes.rst | 2 ++ doc/integrate.rst | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 82ddda0..da20cc3 100644 --- a/README.rst +++ b/README.rst @@ -62,7 +62,7 @@ Main features - Extensible : easy to add more protocols or more base types. - Framework independance : adapters are provided to easily integrate your API in any web framework, for example a wsgi container, - Pecan_, TurboGears_, cornice_... + Pecan_, TurboGears_, Flask_, cornice_... - Very few runtime dependencies: webob, simplegeneric. Optionnaly lxml and simplejson if you need better performances. - Integration in `Sphinx`_ for making clean documentation with @@ -70,6 +70,7 @@ Main features .. _Pecan: http://pecanpy.org/ .. _TurboGears: http://www.turbogears.org/ +.. _Flask: http://flask.pocoo.org/ .. _cornice: http://pypi.python.org/pypi/cornice Install diff --git a/doc/changes.rst b/doc/changes.rst index 3037faf..a24b462 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -4,6 +4,8 @@ Changes next ---- +* New Flask adapter: wsmeext.flask + * Fix: Submodules of wsmeext were missing in the packages. * Fix: The demo app was still depending on the WSME-Soap package (which has diff --git a/doc/integrate.rst b/doc/integrate.rst index 00d2720..2a95fa7 100644 --- a/doc/integrate.rst +++ b/doc/integrate.rst @@ -110,6 +110,44 @@ Example print("Got a message: %s" % info.message) +.. _adapter-flask: + +Flask +----- + + *"Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It's BSD licensed! "* + + +.. warning:: + + Flask support is limited to function signature handling. It does not + support additional protocols. This is a temporary limitation, if you have + needs on that matter please tell us at python-wsme@googlegroups.com. + + +:mod:`wsmeext.flask` -- Flask adapter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. module:: wsmeext.flask + +.. function:: signature(return_type, \*arg_types, \*\*options) + + See @\ :func:`signature` for parameters documentation. + + Can be used on a function before routing it with flask. + +Example +~~~~~~~ + +.. code-block:: python + + from wsmeext.flask import signature + + @app.route('/multiply') + @signature(int, int, int) + def multiply(a, b): + return a * b + .. _adapter-pecan: Pecan