[PEAK] Does a PEAK-ized webware esist ?

Phillip J. Eby pje at telecommunity.com
Thu Jan 29 18:32:09 EST 2004


At 04:38 PM 1/29/04 -0600, wayne at larsen.st wrote:

>PEAK/Webware integration could be done in several ways -- however, this
>proposal is not what I was thinking.  You appear to be proposing a way to
>run webware from within the peak framework (ie as a CGI).  This was
>opposite to my thinking, of wanting to embed peak components within
>webware.

Well, the request from gpciceri that I was responding to was for "a PEAK 
wrapper
to webware (similar to the twisted one)".  :)



>I have a couple of existing web apps that are running under the Webware
>framework right now (I am also using MiddleKit, FormKit, and Cheetah).  As
>I was developing a third, I ran into a number of issues related to
>component flexibility, reuse, and configuration -- at the same time, I
>came across PEAK.  It's certainly a mind shift in thinking, and I am still
>grasping at comprehension, but I do believe that there is a lot of
>potential for improvement by integrating PEAK into my applications.  Going
>through PEAK also led me to relook at ZopeX3, leaving me with three
>potential options for moving forward:
>1. Switch to Zope3
>2. Work with peak.web
>3. Integrate PEAK into Webware
>
>So, backing up, what would I see as the perfect framework:
>  - Webware style app server, with the mod_webkit adapter, so that the app
>server can be run behind Apache for dynamic content
>  - Utilize the PEAK config and component frameworks for allowing flexible
>configuration of servlets.  Servlets in a directory tree should allow for
>dynamic discovery and configuration, so that subdirectories can override
>settings as required.
>  - Handle all the default web services, such as session management,
>cookies, log files, headers, already provided via Webware.
>  - Enable reuse of my existing components, and enable pythonic development
>
>So, while ZopeX3 looks to be a marked improvement over Zope2, and I would
>like to understand it better, for now, let's ignore it and look at the two
>other options - peak.web and Webware/PEAK integration.  It would be great
>to see a non trivial application running within peak.web, as there are a
>lot of things I do not understand about it.  I could not get the trivial
>examples to  run right now with Zope3 CVS - however, even if I had that
>running, as far as I can understand, there are a lot of things yet to be
>decided and implemented.

Yes, peak.web is not quite ready for prime time.  I lack sufficient 
bandwidth (aka need) at this moment to get it finished up.  The core is 
pretty much done and there, the rest is a matter of supplying needed 
components to plug into the framework, such as authentication services, UI 
components, etc.


>Thus, I started looking at integrating PEAK and Webware.  To me, this
>means doing the following:
>1. - Convert the configuration system to use peak.config
>2. - Make some of the main classes components
>3. - Convert the UrlParser and ServletFactory components to launch the
>servlets with the appropriate configuration root.
>
>This last step is where I'm at right now - I would like to enable a
>structure like:
>
>ServletRoot/main.ini
>ServletRoot/Site1/
>ServletRoot/Site1/site.ini
>ServletRoot/Site1/index.py
>ServletRoot/Site1/page1.py
>ServletRoot/Site1/subdir/resource.ini
>ServletRoot/Site1/subdir/page2.py
>ServletRoot/Site2/
>ServletRoot/Site2/site.ini
>ServletRoot/Site2/index.py
>..
>
>Looking at peak.ini, it appears that there is support for this style of
>configuration file / path setup, but I have no idea how that would be
>used.
>
>A lot of open issues for me -- any comments?

It looks to me like you're going for a structure based on directory layout 
and dynamic discovery, similar in some ways to what I did with a previous 
framework, ASDF.  'peak.web' is my attempt to get as far *away* from that 
architecture as possible, even though I'll admit that it does offer some 
very enticing "instant gratification".

The shortest route might be for you to use peak.web.resources, and define 
your own factory types for the various sorts of objects you want to have in 
the directories.  The way this stuff is set up, you could write the entire 
app inside of the resources, as long as you're okay with all your URLs 
starting out '/++resources++/my.package/'.  :)

But, personally, I think you might find it an uphill battle, since it's not 
really intended for that development model.  peak.web assumes you are 
creating a Python application in normal Python "module space", and that the 
hierarchical structure comes from the hierarchy of your "view 
components".  Resources can then be either objects that are needed by the 
view components to do their thing (like page templates for their methods), 
or static data served up as things like images, scripts, PDF files, or 
whatever.  It's not really designed for building the application out of the 
resources, though you certainly could do it if you set your mind to it.




More information about the PEAK mailing list