changeset 1681:fc03cd8ff0f3

avoid accessing invalid page revisions, tune caching code (ported from 1.5)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 19 Nov 2006 17:43:01 +0100
parents eee86327fe92
children 30116d7d098a
files MoinMoin/Page.py MoinMoin/caching.py
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun Nov 19 17:36:50 2006 +0100
+++ b/MoinMoin/Page.py	Sun Nov 19 17:43:01 2006 +0100
@@ -212,9 +212,12 @@
 
         revstr = '%08d' % rev
         pagefile = os.path.join(pagedir, 'revisions', revstr)
-        exists = os.path.exists(pagefile)
-        if exists:
-            self._setRealPageName(pagedir)
+        if rev != 99999999:
+            exists = os.path.exists(pagefile)
+            if exists:
+                self._setRealPageName(pagedir)
+        else:
+            exists = False
         return pagefile, rev, exists
 
     def _setRealPageName(self, pagedir):
--- a/MoinMoin/caching.py	Sun Nov 19 17:36:50 2006 +0100
+++ b/MoinMoin/caching.py	Sun Nov 19 17:43:01 2006 +0100
@@ -76,8 +76,9 @@
             return 0
 
     def needsUpdate(self, filename, attachdir=None):
-        if not self.exists():
-            return 1
+        # following code is not necessary. will trigger exception and give same result
+        #if not self.exists():
+        #    return 1
 
         try:
             ctime = os.path.getmtime(self._filename())