pull and commit should be much more useful about conflicts
[mw] / src / mw / metadir.py
index 66641e9ba7a972e3e81f600729714a5b80a5bf8f..0549c83b4232850e28754dd77db5308e0f4f36c6 100644 (file)
@@ -127,19 +127,25 @@ class Metadir(object):
     def pages_get_rv_list(self, 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()]
-        rvs.sort()
-        return rvs
+        if os.path.exists(pagefile):
+            fd = file(pagefile, 'r')
+            pagedata = json.loads(fd.read())
+            rvs = [int(x) for x in pagedata.keys()]
+            rvs.sort()
+            return rvs
+        else:
+            return [None,]
 
     def pages_get_rv(self, pageid, rvid):
         pagefile = os.path.join(self.location, 'cache', 'pages',
                                 str(pageid['id']))
-        fd = file(pagefile, 'r')
-        pagedata = json.loads(fd.read())
-        return pagedata[str(rvid)]
-
+        if os.path.exists(pagefile):
+            fd = file(pagefile, 'r')
+            pagedata = json.loads(fd.read())
+            return pagedata[str(rvid)]
+        else:
+            return None
+            
     def working_dir_status(self, files=None):
         status = {}
         check = []

Benjamin Mako Hill || Want to submit a patch?