X-Git-Url: https://projects.mako.cc/source/mw/blobdiff_plain/90afbee67cd871468f755c9a9769d53adca9941c..2c860f8d2f73c9d7322953b40b28927cef0187b9:/src/mw/metadir.py diff --git a/src/mw/metadir.py b/src/mw/metadir.py index 67e0b09..e09c840 100644 --- a/src/mw/metadir.py +++ b/src/mw/metadir.py @@ -20,9 +20,10 @@ import ConfigParser 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() @@ -30,7 +31,7 @@ class Metadir(object): 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 @@ -106,7 +107,8 @@ class Metadir(object): 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()] @@ -114,7 +116,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)]