From 3b1168ef26a7eeb95be9fe0ddf7a9242a932e3f5 Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Sun, 12 Aug 2012 15:07:02 +0200 Subject: [PATCH] Change the wsgi example to match the new way of obtaining a wsgi app from a WSRoot. Add a bottle integration example --- doc/integrate.rst | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/doc/integrate.rst b/doc/integrate.rst index e19ee67..333156f 100644 --- a/doc/integrate.rst +++ b/doc/integrate.rst @@ -4,32 +4,44 @@ Integrating with a Framework WSGI Application ---------------- -:mod:`wsme.wsgi` -- WSGI adapter -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. module:: wsme.wsgi - -.. function:: adapt - - Returns a wsgi application that serve a :class:`wsme.controller.WSRoot`. +The :func:`wsme.WSRoot.wsgiapp` function of WSRoot returns a wsgi +application. Example ~~~~~~~ .. code-block:: python - from wsme import * - import wsme.wsgi + from wsme import WSRoot, expose + class MyRoot(WSRoot): @expose(unicode) def helloworld(self): return u"Hello World !" - application = wsme.wsgi.adapt( - MyRoot(protocols=['restjson'])) + root = MyRoot(protocols=['restjson']) + application = root.wsgiapp() +Bottle +------ + +.. code-block:: python + + import bottle + import wsme + + class MyRoot(wsme.WSRoot): + @wsme.expose(unicode) + def helloworld(self): + return u"Hello World !" + + root = MyRoot(webpath='/ws', protocols=['restjson']) + + bottle.mount('/ws', root.wsgiapp()) + bottle.run() + Pyramid -------