
Jason> On Linux, "whitelist.db" = whitelist.db when the default module is Jason> dbhash, so there is no problem: ... Jason> However on Solaris for example (default module of dbm): Jason> % python -c "import anydbm;wl = anydbm.open('whitelist.db','c')" Jason> % ls -l whitelist* Jason> -rw------- 1 jason users 0 Nov 29 19:13 whitelist.db.dir Jason> -rw------- 1 jason users 0 Nov 29 19:13 whitelist.db.pag Jason> Under Linux, the dbm module acts differently, adding a '.db' Jason> suffix to the given filename: Jason> % python -c "import dbm;wl = dbm.open('whitelist.db','c')" Jason> % ls -l whitelist* Jason> -rw------- 1 jasonrm acl 16384 Nov 29 17:21 whitelist.db.db Jason> So, I can't rely on comparing "whitelist" with "whitelist.db" Jason> filename to filename since the latter might not exist. ... Jason> Does anyone have some suggestions on how I might support this Jason> feature in a cross-platform, and generic fashion? Seems to me the natural thing to do would be to add "get_data_filename" and "get_index_filename" methods (or something similar) to the underlying modules (dbhash, bsddb, dbm, etc) and expose them through anydbm. It's too late for 2.2, but I suspect if you implemented something and method name(s) could be settled on it would make it into CVS early in the 2.3 cycle. This seems like a small enough change that you just file a bug report on SourceForge with the proposal and add an implementation when you have something workable. -- Skip Montanaro (skip@pobox.com - http://www.mojam.com/)

Skip Montanaro <skip@pobox.com> writes:
I see. So you agree that with the current implementation, there isn't a reliable way to do what I'm trying to do with DBM?
I'm not sure when I'll be able to get to this, but I'll put it on my TODO list. In the meantime, I think I'll just support the auto regeneration feature I mentioned with CDB[1] instead of DBM since its file interface is consistent across platforms. Footnotes: 1. python-cdb extension module (http://pilcrow.madison.wi.us/) -- (TMDA - http://tmda.sourceforge.net) (Python-based SPAM reduction system)

Skip Montanaro <skip@pobox.com> writes:
I see. So you agree that with the current implementation, there isn't a reliable way to do what I'm trying to do with DBM?
I'm not sure when I'll be able to get to this, but I'll put it on my TODO list. In the meantime, I think I'll just support the auto regeneration feature I mentioned with CDB[1] instead of DBM since its file interface is consistent across platforms. Footnotes: 1. python-cdb extension module (http://pilcrow.madison.wi.us/) -- (TMDA - http://tmda.sourceforge.net) (Python-based SPAM reduction system)
participants (2)
-
Jason R. Mastaler
-
Skip Montanaro