import json
import os
import sys
-import time
+
class Metadir(object):
+
def __init__(self):
self.me = os.path.basename(sys.argv[0])
root = os.getcwd()
if '.mw' in os.listdir(root):
self.root = root
break
- (head, tail) = os.path.split(root)
+ head = os.path.split(root)[0]
if head == root:
self.root = os.getcwd()
break
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)]