changeset 4927:27d5d0b875a9

Groups2009: wiki_groups and wiki_dicts caching fix.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Thu, 06 Aug 2009 18:27:45 +0200
parents 7a8e1567e7e4
children 6c4c93f896f8 9f9a1dca5de5 ad551d80e556
files MoinMoin/datastruct/backends/wiki_dicts.py MoinMoin/datastruct/backends/wiki_groups.py
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/datastruct/backends/wiki_dicts.py	Sat Aug 01 18:10:46 2009 +0200
+++ b/MoinMoin/datastruct/backends/wiki_dicts.py	Thu Aug 06 18:27:45 2009 +0200
@@ -10,6 +10,7 @@
 
 
 import re
+import math
 
 from MoinMoin import caching, wikiutil
 from MoinMoin.Page import Page
@@ -43,8 +44,11 @@
             try:
                 cache_mtime = cache.mtime()
                 page_mtime = wikiutil.version2timestamp(page.mtime_usecs())
-                # TODO: fix up-to-date check mtime granularity problems
-                if cache_mtime > page_mtime:
+                # TODO: fix up-to-date check mtime granularity problems.
+                #
+                # cache_mtime is float while page_mtime is integer
+                # The comparision needs to be done on the lowest type of both
+                if math.floor(cache_mtime) > math.floor(page_mtime):
                     # cache is uptodate
                     return cache.content()
                 else:
--- a/MoinMoin/datastruct/backends/wiki_groups.py	Sat Aug 01 18:10:46 2009 +0200
+++ b/MoinMoin/datastruct/backends/wiki_groups.py	Thu Aug 06 18:27:45 2009 +0200
@@ -18,6 +18,7 @@
             2009 MoinMoin:DmitrijsMilajevs
 @license: GPL, see COPYING for details
 """
+import math
 
 from MoinMoin import caching, wikiutil
 from MoinMoin.Page import Page
@@ -39,8 +40,11 @@
             try:
                 cache_mtime = cache.mtime()
                 page_mtime = wikiutil.version2timestamp(page.mtime_usecs())
-                # TODO: fix up-to-date check mtime granularity problems
-                if cache_mtime > page_mtime:
+                # TODO: fix up-to-date check mtime granularity problems.
+                #
+                # cache_mtime is float while page_mtime is integer
+                # The comparision needs to be done on the lowest type of both
+                if math.floor(cache_mtime) > math.floor(page_mtime):
                     # cache is uptodate
                     return cache.content()
                 else: