changeset 1475:925bbdfe0ab9

check if the correct version of xapian is installed
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Wed, 23 Aug 2006 23:37:17 +0200
parents b5864c9492fb
children 25ba2875b406
files MoinMoin/search/Xapian.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/Xapian.py	Wed Aug 23 22:48:01 2006 +0200
+++ b/MoinMoin/search/Xapian.py	Wed Aug 23 23:37:17 2006 +0200
@@ -27,6 +27,7 @@
 except ImportError:
     Stemmer = None
 
+
 class UnicodeQuery(xapian.Query):
     """ Xapian query object which automatically encodes unicode strings """
     def __init__(self, *args, **kwargs):
@@ -196,12 +197,26 @@
     }
 
     def __init__(self, request):
+        self._check_version()
         BaseIndex.__init__(self, request)
 
         # Check if we should and can stem words
         if request.cfg.xapian_stemming and not Stemmer:
             request.cfg.xapian_stemming = False
 
+    def _check_version(self):
+        """ Checks if the correct version of Xapian is installed """
+        if xapian.xapian_major_version() == 0 and \
+                xapian.xapian_minor_version() == 9 \
+                and xapian.xapian_revision() >= 6:
+            return
+        
+        from MoinMoin.error import ConfigurationError
+        raise ConfigurationError('MoinMoin needs at least Xapian version '
+                '0.9.6 to work correctly. Either disable Xapian '
+                'completetly in your wikiconfig or upgrade your Xapian '
+                'installation!')
+
     def _main_dir(self):
         """ Get the directory of the xapian index """
         if self.request.cfg.xapian_index_dir: