[PEAK] Does a PEAK-ized webware esist ?

Phillip J. Eby pje at telecommunity.com
Wed Jan 28 19:08:18 EST 2004


At 06:49 PM 1/28/04 -0500, Phillip J. Eby wrote:
>At 11:57 PM 1/28/04 +0100, gian paolo ciceri wrote:
>
>
>>Hi all,
>>is somewhere an attempt to provide a PEAK wrapper
>>to webware (similar to the twisted one) ?
>
>I have zero WebWare experience.  But if you can point me to the "twisted 
>one" you refer to above, I might be able to offer a suggestion as to how 
>to port it.

Actually, I just found it.  It looks sort of like the closest thing to 
doing that in PEAK would be to create an IRerunnableCGI adapter for either 
an Application or an AppServer.

I get the impression it would look something like:

class AppAsRerunnableCGI(protocols.Adapter):

     protocols.advise(
         instancesProvide=[running.IRerunnableCGI],
         asAdapterForTypes=[Application],
     )

     def runCGI(self,stdin,stdout,stderr,environ):
         self.subject.dispatchRawRequest(
             {
                   "format": "CGI",
                   "time": time.time(),
                   "environ": environ,
                   "input": stdin,       # XXX is this right?
             },
             stdout
         )

The main parts I'm not sure about here are the input=stdin part and the 
directly passing 'stdout'.  Someone more familiar with Webware will 
hopefully pipe up on these aspects.

Anyway, if this is correct, you could then simply supply an 'Application' 
instance to any of PEAK's "containers" that run IRerunnableCGI objects, 
such as 'peak launch', 'peak serve', 'peak CGI', and 'peak supervise'.

If you want to integrate the app so that it uses other PEAK components, you 
should mix in 'binding.Component' as a base class, and then you'll be able 
to bind to services from your application, and your application class will 
be usable as a factory, e.g.:

     peak launch import:mypackage.MyAppClass

to fire up an instance of your application in a browser.

Please let me know if any of this is anywhere close to answering your 
questions.




More information about the PEAK mailing list