[PEAK] Interfacing Peak with Twisted
Tiago Cogumbreiro
cogumbreiro at gmail.com
Wed Mar 16 20:10:04 EST 2005
Thanks alot John, that was exactly the kind of example I was looking for :)
On Wed, 16 Mar 2005 04:16:48 -0800, John Landahl <john at landahl.org> wrote:
> Tiago Cogumbreiro wrote:
> ...
> > I wanted to test the Peak framework and interface it with Twisted. One
> > problem I had was that the wiki page[1] @ devcenter has a file for
> > download with 0 byte length. There might be something wrong with it.
> > Does someone have it so I can have a glance? The exercise I want to do
> > is to extend the bulletins[2] example and add it i) a ZoDB storage ii)
> > a xmlrpc frontend (using twisted) and possibly a nevow frontend too.
>
> With PEAK's EventDriven class, using PEAK and Twisted together is very
> simple. The attached program uses the Example class from Twisted's
> XMLRPC docs [1] within a simple App class derived from EventDriven. You
> can run it with something like the following:
>
> PYTHONPATH=. peak import:twisted1.App
>
> The example client code works exactly the same:
>
> >>> import xmlrpclib
> >>> s = xmlrpclib.Server('http://localhost:7080/')
> >>> s.echo("lala")
> 'lala'
> >>> s.add(1, 2)
> 3
>
> Note how the Twisted reactor is obtained in the App class, and how the
> __onStart method tells the reactor to listen with the given server
> object and port number. Using every other Twisted service follows from
> this example, so it should be about as simple to setup a Twisted web
> server for use with Nevow.
>
> - John
>
> [1] http://tinyurl.com/6wl5r
>
>
>
--
Tiago Cogumbreiro <cogumbreiro at users.sf.net>
http://s1x.homelinux.net/
More information about the PEAK
mailing list