--- a/handlers.py Tue Feb 10 00:04:15 2009 +0200
+++ b/handlers.py Tue Feb 10 00:19:56 2009 +0200
@@ -165,16 +165,23 @@
)
@preferences.handler(prefs.formatter, prefs.count)
-def channel_search (request, channel, formatter, count, q=None, skip=0, max=None) :
+def channel_search (request, channel, formatter, count, q=None, page=1, max=1) :
"""
- Display the search form for the channel for GET, or do the search for POST
+ Display the search form for the channel for GET, or do the search for POST.
"""
+ # calculate skip offset from page/count
+ skip = page * count
+
# got a search query?
if q :
try :
# do search
lines = search_index.search_simple(channel, q, count, skip)
+
+ # update max?
+ if max and page > max :
+ max = page
except log_search.NoResultsFound :
# no lines
@@ -194,6 +201,7 @@
channel = channel,
search_query = q,
count = count,
+ page = page,
skip = skip,
max = max,
lines = lines,