changeset 1626:189bbdd56620

ItemCache: minor code cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 21 Oct 2006 01:09:36 +0200
parents 521da730abab
children 82e8a6a2eb1b
files MoinMoin/Page.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Fri Oct 20 20:59:25 2006 +0200
+++ b/MoinMoin/Page.py	Sat Oct 21 01:09:36 2006 +0200
@@ -47,14 +47,12 @@
         self.refresh(request)
         try:
             data = self.cache[name][key]
+            self.hits += 1
+            hit_str = 'hit'
         except KeyError:
             data = None
+            hit_str = 'miss'
         self.requests += 1
-        if data is not None:
-            self.hits += 1
-            hit_str = 'hit'
-        else:
-            hit_str = 'miss'
         logging.debug("%s cache %s (h/r %2.1f%%) for %r %r" % (
             self.name,
             hit_str,
@@ -80,6 +78,7 @@
                     except:
                         pass
             elif self.name == 'pagelists':
+                logging.debug("cache: clearing pagelist cache")
                 self.cache = {}
 
 
@@ -526,7 +525,7 @@
         """ Does this page exist?
 
         This is the lower level method for checking page existence. Use
-        the higher level methods isUnderlayPagea and isStandardPage for
+        the higher level methods isUnderlayPage and isStandardPage for
         cleaner code.
 
         @param rev: revision to look for. Default check current