Change copyright year
[mw] / src / mw / metadir.py
index 643024ecc9e7d3d8831360b749e8a615ec9800f2..f7f2fba90e64942d933442eeabe1e1f3501993b0 100644 (file)
@@ -1,6 +1,6 @@
 ###
 # mw - VCS-like nonsense for MediaWiki websites
-# Copyright (C) 2009  Ian Weller <ian@ianweller.org>
+# Copyright (C) 2010  Ian Weller <ian@ianweller.org>
 #
 # 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)]

Benjamin Mako Hill || Want to submit a patch?