[mod_python] dbhash or pickle

Jim Gallacher jg.lists at sympatico.ca
Mon Jun 6 13:30:30 EDT 2005


Huzaifa Tapal wrote:
> I am in the process of extending a python based web app framework that I 
> recently converted to mod_python.  I want to store the web app 
> configuration in some form of pickle type file that can be modified with 
> ease.  I was looking into the dbm use by mod python for DBM Session and 
> was wondering if using that is better than pickling and unpickling.

DbmSession (and the forth coming FileSession) use pickles to store the 
session data, so it's pretty much the same thing. However, sessions have 
a timeout value at which time the session data will be deleted, so a 
session may not be the best place to store configuration data.

> My goal really was to store the configuration in memory for use by any 
> applications running in the framework to use and when the web app 
> configuration is modified through a management interface, that in-memory 
> configuration is updated and rewritten to the file-based configuraiton 
> file.

This is probably obvious but make sure you consider file locking issues 
so 2 processes are not trying to modify the filesystem data at the same 
time.

Regards,
Jim

> Would saving that dictionary based configuration be much better if saved 
> in the dbm file?  Any thoughts on what could be the best approach to this?
> 
> Hozi
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 



More information about the Mod_python mailing list