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()]
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)]