nicdumz@svn.wikimedia.org ha scritto:
Revision: 6756 Author: nicdumz Date: 2009-04-30 01:47:36 +0000 (Thu, 30 Apr 2009)
Log Message:
Adding an experimental contents_on_disk feature: save the Page contents on disk, in a python shelf, and load them only when needed, instead of loading the contents in RAM.
Activating this option might slow down a bit the whole interwiki process: fetching an entry on disk is slower than simply fetching in RAM the attribute. This should however greatly reduce the memory consumption.
[...]
Modified: trunk/pywikipedia/interwiki.py
[...]
# (C) Rob W.W. Hooft, 2003 # (C) Daniel Herding, 2004 # (C) Yuri Astrakhan, 2005-2006 +# (C) Pywikipedia bot team, 2007-2009
I think you should put your name instead of a generic "Pywikipedia bot team" copyright statement. A comment from original authors would be preferable though.
index = 1
while True:
path = config.datafilepath('cache', 'pagestore' + str(index))
if not os.path.exists(path): break
index += 1
At least this looks nice for diskcache module too, so we can easily get rid of the imported random module and the ugly '*-abfdexjwi' like filenames.
It's also not necessary to set theses line as a Subject destructor:
these