[mod_python] dbhash or pickle

Huzaifa Tapal huzaifa at hostway.com
Mon Jun 6 18:24:26 EDT 2005

Well actually I was going to consider setting up configuration like the 
DBM Session by loading a dbm file and unpickling the config dict and 
save it back in it after the change.  I wasn't planning on using the 
Session since I don't use mod_python's Session management anyway.

I was trying to figure out what would be the best approach to saving the 
configuration on disk and keep the persistent one updated at the same 
time.  I am really trying to figure out whether to use the dbm to store 
the config dict pickle makes sense or should the pickle itself be just 
stored on disk directly.


Jim Gallacher wrote:

> 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