-winston
On Feb 3, 2005, at 2:17 AM, Eric Radman wrote:
On 23:09 Tue 01 Feb , Ian Bicking wrote:_________________________________________
BTW, I have written a config parser with WSGIKit in mind, but I
haven't plugged it into anything yet. I described some of the
features here: http://blog.ianbicking.org/2005-01-wsgikit-config.html
I don't think we need a configuration parser in the tree at all. The
easiest and most flexible solution is to simply import * from a .py
config file. Think of it as a place to define environment variables.
Here's a quick example: TMDA is a mail filter that is is designed to
work with individual UNIX accounts, but if I want to do virtual e-mail
hosting I could extend it's delivery logic froms:
DELIVERY = "~/.maildir/"
to:
DELIVERY = "/home/vmail/%s/%s/" % (os.environ["HOST"], os.environ["USER"])
This expanded the functionality of this software not by re-writing or
subclassing the tmda libraries, but by adding some brains to the
configuration file itself.
In some ways it bothers me because it's a bit complicated, but each
point of complication is also a feature I think would be really
useful, so it's hard to say.
Importing a file like config.py is simple if we think of it as a place
to define environment variables. The Webware application server is more
complicated because it lists out the guts of a dictionary. Webware looks
like this:
{
'SessionStore': 'Dynamic', # can be File or Dynamic or Memory
'SessionTimeout': 180, # minutes
'MaxDynamicMemorySessions': 10000, # maximum sessions in memory
}
I'm proposing this:
SESSION_STORE='Dynamic' # can be File or Dynamic or Memory
SESSION_TIMEOUT=180 # minutes
MAX_DYNAMIC_SESSIONS=1000 # maximum sessions in memory
Because this file has a .py extension the user knows the rules of the
config file because it's python. This means of setting global parameters
also also allows the user to define any site-specific parameters in the
same file; such as:
DB_CONN='dbname=mydb user=fog'
--
Eric Radman
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss
winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating