Description

In a wiki farm setup, the config files can have arbitrary names, matching the wiki name - e.g. stats.py. If the config file name exists in the Moin tree, then the Moin code may be imported instead of the wiki config file, and an error 'Could not find required "Config" class in "stats.py"' results.

Steps to reproduce

  1. Make a wiki farm
  2. Make a wiki instance called 'stats'
  3. Accessing this wiki generates an error 'Could not find required "Config" class in "stats.py"'

Details

From an email from Thomas Waldemann: you can hack MoinMoin/multiconfig.py to get more information:

Go to function _makeConfig(name).

See "except AttributeError" (and the error msg you got is below that).

Replace that code by something like (indent correctly as it was!):

   except AttributeError, err:
       msg = '''%(err)s
... (keep old text)
''' % {'name': name, 'err': err, }
       raise error.ConfigurationError(msg)

This reveals that Moin is trying to import its own stats module:

     * configClass /undefined/
     * /builtin/ *getattr* = <built-in function getattr>
     * *module* = <module 'MoinMoin.stats' from
      '/usr/local/lib/python2.4/site-packages/MoinMoin/stats/__init__.pyc'>

Traceback from unmodified Moin setup (except showing path) at configtraceback.html

Workaround

Use unique wiki config names, that does not clash with Python or MoinMoin modules, like name_wiki.py or name_config.py.

Discussion

If someone has an idea how to fix this, we would be grateful:

What if you set the system path to:

sys.path = ['path/to/wikicofnigs', 'path/to/moin'] + sys.path

The path in your traceback is:

System path is /usr/local/var/moin /var/www/cgi-bin ...

Are your wikiconfigs in /usr/local/var/moin or /var/www/cgi-bin?

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/WikiConfigNameCanClashWithMoinCode (last edited 2007-10-29 19:09:48 by localhost)