Description
After upgrading from 1.5.3 to 1.9.2 and then to 1.9.3 error 500 shows up, mostly from:
File "/usr/lib/pymodules/python2.6/MoinMoin/theme/__init__.py", line 1553, in ui_lang_attr return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang)) File "/usr/lib/pymodules/python2.6/MoinMoin/i18n/__init__.py", line 257, in getDirection return languages[lang]['x-direction'] TypeError: 'NoneType' object is unsubscriptable
Looks like ['x-direction'] doesn't exist.
Steps to reproduce
- Install python-moinmoin (1.9.3) from Ubuntu natty/maverick repository on lucid (10.04) system - you have to do it manually (dpkg -i) because in lucid repo there is only python-moinmoin 1.9.2 version available
- Set up wikifarm with apache and WSGI mod
Doesn't matter if language_default = 'en' or language_ignore_browser = True are set. Rest of settings is rather default.
Example
Internal server error 500
Component selection
- general
Details
MoinMoin Version |
1.9.3 |
OS and Version |
Linux Ubuntu 10.04 (lucid) server amd64 |
Python Version |
2.6.5 |
Server Setup |
wikifarm on Apache + mod_wsgi |
Server Details |
|
Language you are using the wiki in (set in the browser/UserPreferences) |
'en' |
Workaround
In /usr/lib/pymodules/python2.6/MoinMoin/i18n/__init__.py
comment out default return languages...
add return 'ltr'
def getDirection(lang): """ Return the text direction for a language, either 'ltr' or 'rtl'. """ #return languages[lang]['x-direction'] return 'ltr'
Discussion
en.po has the X-Direction metadata. So likely languages is still None. Maybe stop moin, clear the caches, start moin.
Once the language cache is initialized properly, it won't happen again.
- == Janek ==
Which one is the language cache? I tried to clean all before with moin --config-dir=/etc/moin --wiki-url=MYWIKI maint cleancache and manually removing cache dir content from data/pages/PAGENAME/ . But this error was still there.
data/cache/i18n/*
Plan
- Priority:
- Assigned to:
- Status: bug title / analysis / fix likely not quite correct, issues is basically known but only happens in rare circumstances (e.g. on upgrade, wrong / incomplete cache, etc.).