diff --git a/doc/api.rst b/doc/api.rst index a8f02b5..62f0134 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -1,18 +1,8 @@ API === -Core API --------- - -.. autoclass:: wsme.WSRoot +.. autoclass:: wsme.controller.WSRoot .. autoclass:: wsme.expose .. autoclass:: wsme.validate -Protocols ---------- - -.. autoclass:: wsme.protocols.restjson.RestJsonProtocol -.. autoclass:: wsme.protocols.restxml.RestXmlProtocol -.. autoclass:: wsme.protocols.soap.SoapProtocol - diff --git a/doc/changes.rst b/doc/changes.rst index 37b2982..ef87e4e 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,6 +1,13 @@ Changes ======= +next +---- + +* Add specialised WSRoot classes for easy integration as a + WSGI Application (:class:`wsme.wsgi.WSRoot`) or a + TurboGears 1.x controller (:class:`wsme.tg1.WSRoot`). + 0.1.0a2 (2011-10-07) -------------------- diff --git a/doc/index.rst b/doc/index.rst index 51a1dd7..84e4be9 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -26,6 +26,7 @@ Contents gettingstarted api + protocols integrate changes diff --git a/doc/integrate.rst b/doc/integrate.rst index e863078..f0537f0 100644 --- a/doc/integrate.rst +++ b/doc/integrate.rst @@ -1,13 +1,49 @@ Integrating with a Framework ============================ +WSGI Application +---------------- + +:mod:`wsme.wsgi` -- WSGI adapter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. module:: wsme.wsgi + +.. class:: WSRoot + + A :class:`wsme.controller.WSRoot` that act as a WSGI application. + +Example +~~~~~~~ + +.. code-block:: python + + from wsme import expose, validate + from wsme.wsgi import WSRoot + from wsme.protocols import restjson + + class MyRoot(WSRoot): + @expose(unicode) + def helloworld(self): + return u"Hello World !" + + application = MyRoot(protocols=['REST+Json']) + Turbogears 1.x -------------- +:mod:`wsme.tg1` -- TG1 adapter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + .. module:: wsme.tg1 -wsme.tg1 provides a WSRoot controller that can be part of your -controller tree. +.. class:: WSRoot + + A :class:`wsme.controller.WSRoot` that can be inserted in a TG1 + controller tree. + +Example +~~~~~~~ In a freshly quickstarted tg1 application (let's say, wsmedemo), the prefered way is the following : @@ -37,6 +73,6 @@ Insert the ws controller in the controller tree, (file controllers.py): import wsme.protocols.restjson class Root(controllers.RootController): - ws = WSController(webpath='ws', protocols=['REST+Json']) + ws = WSController(webpath='/ws', protocols=['REST+Json']) # ... diff --git a/doc/protocols.rst b/doc/protocols.rst new file mode 100644 index 0000000..56e97c8 --- /dev/null +++ b/doc/protocols.rst @@ -0,0 +1,20 @@ +Protocols +========= + +REST+Json +--------- + +.. autoclass:: wsme.protocols.restjson.RestJsonProtocol + + +REST+XML +-------- + +.. autoclass:: wsme.protocols.restxml.RestXmlProtocol + + +SOAP +---- + +.. autoclass:: wsme.protocols.soap.SoapProtocol + diff --git a/doc/todo.rst b/doc/todo.rst new file mode 100644 index 0000000..fa1d22f --- /dev/null +++ b/doc/todo.rst @@ -0,0 +1,36 @@ +TODO +==== + +WSME is a work in progress. Here is a list of things that should +be done : + +- Improve the protocol factory -> we should not have to import the + module manually except if we need special parameters. + For example, calling WSRoot.addprotocol('restjson') should just + work, wether or not the wsme.protocols.restjson has been imported yet. + +- Fix the SOAP protocol : the namespace for parameters is not correctly + handle -> some tests with suds should help. + +- Implement new protocols : + + - json-rpc + + - xml-rpc + + - ExtDirect + +- Implement adapters for other framework : + + - TurboGears 2 + + - Pyramid + + - Pylons + + - CherryPy + + - others ? + +- Add unittests for adapters +