changeset 1506:21e85d9d355e

small cleanups, advanced ui can preserve search terms from other ui
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Sat, 26 Aug 2006 22:27:15 +0200
parents c4f111e61e16
children 9618ce536d46
files MoinMoin/macro/AdvancedSearch.py MoinMoin/search/builtin.py
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/AdvancedSearch.py	Sat Aug 26 21:55:47 2006 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Sat Aug 26 22:27:15 2006 +0200
@@ -16,10 +16,20 @@
 
 
 def form_get(request, name, default=''):
+    """ Fetches a form field
+    
+    @param request: current request
+    @param name: name of the field
+    @keyword default: value if not present (default: '')
+    """
     return request.form.get(name, [default])[0]
 
 
 def advanced_ui(macro):
+    """ Returns the code for the advanced search user interface
+
+    @param macro: current macro instance
+    """
     _ = macro._
     f = macro.formatter
     request = macro.request
@@ -44,7 +54,7 @@
         ]) for txt, input_field in (
             (_('containing all the following terms'),
                 '<input type="text" name="and_terms" size="30" value="%s">'
-                % form_get(request, 'and_terms')),
+                % (form_get(request, 'and_terms') or form_get(request, 'value'))),
             (_('containing one or more of the following terms'),
                 '<input type="text" name="or_terms" size="30" value="%s">'
                 % form_get(request, 'or_terms')),
--- a/MoinMoin/search/builtin.py	Sat Aug 26 21:55:47 2006 +0200
+++ b/MoinMoin/search/builtin.py	Sat Aug 26 22:27:15 2006 +0200
@@ -489,9 +489,9 @@
             from MoinMoin.search.Xapian import Index
             index = Index(request)
         except ImportError:
-            index = None
+            return None
 
-        if index and index.exists():
+        if index.exists():
             return index
 
     _xapianIndex = staticmethod(_xapianIndex)