changeset 2978:b2546fd98514

search results: fix calculation of current/total result pages to use integers only (fixes DeprecationWarnung for range() with floats) (port from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 05 Jan 2008 23:02:27 +0100
parents 6fdae05f0eeb
children b95840d1e675
files MoinMoin/search/results.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/results.py	Sat Jan 05 22:05:54 2008 +0100
+++ b/MoinMoin/search/results.py	Sat Jan 05 23:02:27 2008 +0100
@@ -674,10 +674,11 @@
             return self.request.page.url(self.request, querydict,
                     escape=0, relative=False)
 
-        pages = float(hitsNum) / hitsPerPage
-        if pages - int(pages) > 0.0:
-            pages = int(pages) + 1
-        cur_page = hitsFrom / hitsPerPage
+        pages = hitsNum // hitsPerPage
+        remainder = hitsNum % hitsPerPage
+        if remainder:
+            pages += 1
+        cur_page = hitsFrom // hitsPerPage
 
         textlinks = []