changeset 1455:d20d04b46ed4

correct pagelinks for older revisions and seach results pages links
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Tue, 22 Aug 2006 21:05:11 +0200
parents 4f355732e01f
children 69bedb8bda21
files MoinMoin/search/builtin.py MoinMoin/search/results.py
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/builtin.py	Tue Aug 22 20:13:48 2006 +0200
+++ b/MoinMoin/search/builtin.py	Tue Aug 22 21:05:11 2006 +0200
@@ -374,7 +374,7 @@
         if not self.filtered:
             hits = self._filter(hits)
 
-        # when xapian was used, we won't need to sort manually
+        # when xapian was used, we can estimate the numer of matches
         if self.request.cfg.xapian_search:
             self.sort = None
             mset = self._xapianMset
@@ -522,7 +522,7 @@
             if 'revision' in valuedict and valuedict['revision']:
                 revision = int(valuedict['revision'])
             else:
-                revision = None
+                revision = 0
 
             if wikiname in (self.request.cfg.interwikiname, 'Self'): # THIS wiki
                 page = Page(self.request, pagename, rev=revision)
@@ -540,7 +540,7 @@
                     if matches:
                         hits.append((wikiname, page, attachment, matches))
             else: # other wiki
-                hits.append((wikiname, pagename, attachment, None))
+                hits.append((wikiname, pagename, attachment, None, revision))
         return hits
 
     def _getPageList(self):
--- a/MoinMoin/search/results.py	Tue Aug 22 20:13:48 2006 +0200
+++ b/MoinMoin/search/results.py	Tue Aug 22 21:05:11 2006 +0200
@@ -346,6 +346,11 @@
                         'do': 'get',
                         'target': page.attachment,
                     }
+                elif page.page.rev and page.page.rev != page.page.getRevList()[0]:
+                    querydict = {
+                        'action': 'recall',
+                        'rev': page.page.rev,
+                    }
                 else:
                     querydict = None
                 querystr = self.querystring(querydict)
@@ -425,7 +430,13 @@
                     querydict = None
                 else:
                     fmt_context = self.formatContext(page, context, maxlines)
-                    querydict = None
+                    if page.page.rev and page.page.rev != page.page.getRevList()[0]:
+                        querydict = {
+                            'action': 'recall',
+                            'rev': page.page.rev,
+                        }
+                    else:
+                        querydict = None
                 querystr = self.querystring(querydict)
                 item = [
                     f.definition_term(1),
@@ -667,7 +678,8 @@
         querydict = wikiutil.parseQueryString(self.request.query_string)
         def page_url(n):
             querydict.update({'from': n * hitsPerPage})
-            return self.request.page.url(self.request, querydict, escape=0)
+            return self.request.page.url(self.request, querydict,
+                    escape=0, relative=False)
         
         pages = float(hitsNum) / hitsPerPage
         if pages - int(pages) > 0.0: