X-Git-Url: https://projects.mako.cc/source/mw/blobdiff_plain/2699c75f1d264d5d960289e4a11b687a87bb9943..f5846ccc4228fab747eebc991ea97fd3238aea39:/src/mw/metadir.py diff --git a/src/mw/metadir.py b/src/mw/metadir.py index 643024e..f7f2fba 100644 --- a/src/mw/metadir.py +++ b/src/mw/metadir.py @@ -1,6 +1,6 @@ ### # mw - VCS-like nonsense for MediaWiki websites -# Copyright (C) 2009 Ian Weller +# Copyright (C) 2010 Ian Weller # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -98,16 +98,18 @@ class Metadir(object): pagedata = json.loads(pagedata_raw) rvid = int(rv['revid']) pagedata[rvid] = { - 'user': rv['user'], 'timestamp': rv['timestamp'], - 'content': rv['*'], + 'user': rv['user'], 'timestamp': rv['timestamp'] } + if '*' in rv.keys(): + pagedata[rvid]['content'] = rv['*'] fd.seek(0) fd.write(json.dumps(pagedata)) fd.truncate() fd.close() def pages_get_rv_list(self, pageid): - pagefile = os.path.join(self.location, 'cache', 'pages', str(pageid)) + pagefile = os.path.join(self.location, 'cache', 'pages', + str(pageid['id'])) fd = file(pagefile, 'r') pagedata = json.loads(fd.read()) rvs = [int(x) for x in pagedata.keys()] @@ -115,7 +117,8 @@ class Metadir(object): return rvs def pages_get_rv(self, pageid, rvid): - pagefile = os.path.join(self.location, 'cache', 'pages', str(pageid)) + pagefile = os.path.join(self.location, 'cache', 'pages', + str(pageid['id'])) fd = file(pagefile, 'r') pagedata = json.loads(fd.read()) return pagedata[str(rvid)]