comparison MoinMoin/config/multiconfig.py @ 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 124d0ef138aa
children 6060395dcdf1 a2709307da3d
comparison
equal deleted inserted replaced
3625:ef3cbfb74b2e 3626:a4e5eed662e1
75 """ 75 """
76 global _url_re_cache, _farmconfig_mtime 76 global _url_re_cache, _farmconfig_mtime
77 if _url_re_cache is None: 77 if _url_re_cache is None:
78 try: 78 try:
79 farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig') 79 farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig')
80 except ImportError: 80 except ImportError, err:
81 logging.debug("could not import farmconfig, mapping all URLs to wikiconfig") 81 if 'farmconfig' in str(err):
82 _farmconfig_mtime = 0 82 # we failed importing farmconfig
83 _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything 83 logging.debug("could not import farmconfig, mapping all URLs to wikiconfig")
84 _farmconfig_mtime = 0
85 _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
86 else:
87 # maybe there was a failing import statement inside farmconfig
88 raise
84 else: 89 else:
85 logging.info("using farm config: %s" % os.path.abspath(farmconfig.__file__)) 90 logging.info("using farm config: %s" % os.path.abspath(farmconfig.__file__))
86 try: 91 try:
87 cache = [] 92 cache = []
88 for name, regex in farmconfig.wikis: 93 for name, regex in farmconfig.wikis: