changeset 3548:419335c7d8ad

optimize Page.editlog_entry(): read log in reverse direction, move str/int conversion outside the loop
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 03 May 2008 17:58:50 +0200
parents 889b37b6441c
children 56b476878a1c
files MoinMoin/Page.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sat May 03 17:45:03 2008 +0200
+++ b/MoinMoin/Page.py	Sat May 03 17:58:50 2008 +0200
@@ -526,9 +526,10 @@
             entry = None
         if entry is None:
             from MoinMoin.logfile import editlog
-            rev = self.get_real_rev()
-            for entry in editlog.EditLog(request, rootpagename=self.page_name):
-                if int(entry.rev) == rev:
+            wanted_rev = "%08d" % self.get_real_rev()
+            edit_log = editlog.EditLog(request, rootpagename=self.page_name)
+            for entry in edit_log.reverse():
+                if entry.rev == wanted_rev:
                     break
             else:
                 entry = () # don't use None