changeset 3626:a4e5eed662e1

better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 20 May 2008 03:42:14 +0200
parents ef3cbfb74b2e
children 5c0b94be4909
files MoinMoin/config/multiconfig.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Tue May 20 02:57:44 2008 +0200
+++ b/MoinMoin/config/multiconfig.py	Tue May 20 03:42:14 2008 +0200
@@ -77,10 +77,15 @@
     if _url_re_cache is None:
         try:
             farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig')
-        except ImportError:
-            logging.debug("could not import farmconfig, mapping all URLs to wikiconfig")
-            _farmconfig_mtime = 0
-            _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
+        except ImportError, err:
+            if 'farmconfig' in str(err):
+                # we failed importing farmconfig
+                logging.debug("could not import farmconfig, mapping all URLs to wikiconfig")
+                _farmconfig_mtime = 0
+                _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
+            else:
+                # maybe there was a failing import statement inside farmconfig
+                raise
         else:
             logging.info("using farm config: %s" % os.path.abspath(farmconfig.__file__))
             try: