[PEAK] Does a PEAK-ized webware esist ?

Wayne Larsen wayne at larsen.st
Thu Jan 29 20:18:33 EST 2004


Ian Bicking wrote:
> wayne at larsen.st wrote:
>>
>> 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.
> 
> 
> There's something along these lines in Standalone WebKit (which is where 
> any of this development would make sense).  URLParser picks up 
> configuration files named "webware.ini", and adds them to a 
> request-specific configuration.  Since you can reroute URL parsing in 
> several ways, you can do something like:
> 
> /MyRoot/webware.ini
> /MyRoot/__init__.py which points to -->
> /AppRoot/...
> 
> Then servlets in AppRoot can see the configuration from 
> /MyRoot/webware.ini, but you don't need to touch the application's files 
> or directory at all.  You can do stuff in __init__.py so that everything 
> is redirected to another directory (after reading the config) without 
> consuming any of the URL.  You should be able to do this redirection in 
> webware.ini, but you can't now -- URL controlling configurations can't 
> be passed along (since they only apply to one location), so there has to 
> be some mechanism either for URLParser to consume configuration, or ways 
> to mark configurations as local, URL-specific, or something.
> 
> I don't think that's all of what you want, but it probably fits in there 
> somewhere.  Potentially URLParser could look for other .ini files to 
> bring into the request.
> 
That is what I was looking at -- I was trying to understand how peak.web 
   maps from a url to an actual resource, since I have a feeling the 
solution I'm looking for is some combination of the two.


> I'm open to suggestions about how Standalone WebKit does configuration. 
>  Maybe PEAK configuration would fit.  This stuff is in 
> Sandbox.ianbicking.WebKit.Configuration (in webware-sandbox.sf.net).
> 
> Some of the details of WebKit.Configuration, which might align with 
> PEAK's configuration, or not:
> 
> * I allow for the possibility of other configuration formats besides 
> .ini, but haven't implemented any other parsers.
> * When option values are retrieved, type information is given.  So 
> there's no configuration schema.
> * While several configuration files are brought in, they all get loaded 
> into the same space (except for configuration files URLParser adds). The 
> only partitioning is the section headers in the .ini files themselves.  
> This includes configuration files URLParser brings in.
> * Configuration.ChainedConfiguration allows you to look through 
> different configurations in order.  This way URLParser's configuration 
> shadows the global configuration.
> * There's a separate URLParser.FileParser instance for each segment of 
> the path, and each instance has its own configuration (or none if 
> there's no webware.ini).  Other kinds of parsers could add configuration 
> differently.  Or the parser could add a configuration when it finds the 
> servlet, i.e., look for servletname.ini and load that configuration.
> 
> I don't really know enough about PEAK configuration to comment on the 
> rest much...
> 
One would think that configuration is a solved problem :)  I'm not sure 
the best way to reconcile the two - I also have a tendency to throw away 
working code that I should be fighting - but it seems simpler to me to 
just use peak's configuration system rather than supporting both.

>> 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
>> ...
> 
> 
> What's the meaning of main.ini, site.ini, and resource.ini?  I.e., what 
> distinguishes them, when do they get loaded, what's their scope?  Is 
> this a PEAK convention?
> 
I was just trying to distinguish between several layers of configuration 
-- site.ini would be the main configuration for a website, but it may be 
possible to consolidate some configuration "ie main.ini", or override it 
(ie resource.ini, which has nothing to do with peak.web's resources.ini).





More information about the PEAK mailing list