Description

If configuration file is not found, you get an empty wiki - header, title and footer - for every page. This is very common bug in new installations or upgrades.

Steps to reproduce

  1. Change the name of your wikiconfig.py, or use wrong name in farmconfig.py wikis list.
  2. You get this for every page:

empty.jpg

Example

Details

MoinMoin Version

1.3.x

Workaround

Fix your configuration:

{{{import sys sys.path.insert(0, '..') }}}

Discussion

The problem is caused by the design of multiconfig, and it is very old. If a config file is not found, the default configuration is used. This was done to allow software tools to use non installed wiki. The problem is that this does not work for installed wikis, and the error is very confusing.

The warnings in the logs are hard to find, and there is no reason to check the log when the wiki "runs". Broken configuration should not let the wiki run.

This is the problem code in multiconfig:

   1 def getConfig(url):
   2     """ Make and return config object
   3 
   4     If the config file is not found or broken, either because of a typo
   5     in farmconfig or deleted file or some other error, we return a
   6     default config, and a warning.
   7 
   8     The default config works with a default installed wiki. If the wiki
   9     is installed using different url_prefix and other settings, it might
  10     not work, because other code does not do proper error checking.
  11     
  12     This is the behavior of moin up to version 1.2
  13 
  14     @param url: the url from request, possibly matching specific wiki
  15     @rtype: DefaultConfig subclass instance
  16     @return: config object for specific wiki
  17     """
  18     match = url_re().match(url)
  19     if match and match.groups():
  20         # Get config module name from match
  21         for name, value in match.groupdict().items():
  22             if value: break
  23 
  24         # FIXME: we should cache config objects by wiki url and return
  25         # here a ready to use config, instead of creating new instance
  26         # for each request.
  27         
  28         try:
  29             module =  __import__(name, globals(), {})
  30             Config = getattr(module, 'Config', None)
  31             if Config:
  32                 # Config found, return config instance
  33                 cfg = Config()
  34                 cfg.siteid = name
  35                 return cfg
  36             else:
  37                 # Broken config file, probably old config from 1.2
  38                 err = 'could not find a "Config" class in "%s.py"; ' \
  39                       'default configuration used instead.' % (name)
  40 
  41         except ImportError, why:
  42             # Broken config file, probably indent problem
  43             err = 'import of config "%s" failed due to "%s"; ' \
  44                   'default configuration used instead.' % (name, why)
  45     else:
  46         # Missing config file, or error in farmconfig.py 
  47         err = 'could not find a config file for url: %s; ' \
  48               'default configuration used instead.' % (url)
  49 
  50     # Warn and return a default config
  51     import warnings
  52     warnings.warn(err)
  53     return DefaultConfig()

The problem with this system is that the default config works on the wiki on the development tree, but not for installed wikis, even if the wiki was installed according to the standard instructions.

fixes:

Progress

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/EmptyWiki (last edited 2007-10-29 19:21:31 by localhost)