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
- Make a wiki farm
- Make a wiki instance called 'stats'
- 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:
MoinMoin/multiconfig.py (_importConfigModule())
MoinMoin/wikiutil.py (importPlugin() etc.)
- Not related to this.
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
- Priority:
- Assigned to:
- Status: In 1.6 I added a hint about the name clash to the error message. Maybe this is all we can do for now.