Description

I cannot move my MoinMoin wiki to another server with the same version MoinMoin installed. I did get it to sucessfully run a copy from one week ago, but when copying a more recent version over, untarring it and cleaning the cache, I get the error noted in the subject. Interestingly, this is the debug output:

/usr/local/lib/python2.7/dist-packages/MoinMoin/user.py in __init__ (self=<MoinMoin.user.User at 0x11c66c8 name:u'rdanek' valid:1>, request=<MoinMoin.request.request_cgi.Request object>, id='1276886381.61.9632', name='', password=None, auth_username='', **kw={})

    361 self.may = Default(self)
    362
    363 if self.language and not self.language in i18n.wikiLanguages():
    364 self.language = 'en'
    365

    self = <MoinMoin.user.User at 0x11c66c8 name:u'rdanek' valid:1>
    self.language = u'en'
    global i18n = <module 'MoinMoin.i18n' from '/usr/local/lib/python2.7/dist-packages/MoinMoin/i18n/__init__.pyc'>
    i18n.wikiLanguages = <function wikiLanguages>

Steps to reproduce

  1. Install MoinMoin 1.8.2 to prep for migration to new server. Old server happily runs it, but other issues require migration.

  2. Tar up wiki dir on old server, scp over to new server, untar, run moin .... maint cleancache.
  3. Restart apache2 which has duplicate setup as old server.
  4. Should be noted that 1 week old migration WORKED, but this most recent one generates the error of this topic.

Example

Traceback

Here is the latest traceback from the site, taken on 11/7.

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

    /usr/local/lib/python2.7/dist-packages/MoinMoin/request/request_cgi.py in __init__ (self=<MoinMoin.request.request_cgi.Request object>, properties={})
        27
        28 self._setup_vars_from_std_env(os.environ)
        29 RequestBase.__init__(self, properties)
        30
        31 except Exception, err:
        global RequestBase = <class 'MoinMoin.request.RequestBase'>
        RequestBase.__init__ = <unbound method RequestBase.__init__>
        self = <MoinMoin.request.request_cgi.Request object>
        properties = {}

    /usr/local/lib/python2.7/dist-packages/MoinMoin/request/__init__.py in __init__ (self=<MoinMoin.request.request_cgi.Request object>, properties={}, given_config=None)
        216 # set self.user even if _handle_auth_form raises an Exception
        217 self.user = None
        218 self.user = self._handle_auth_form(user_obj)
        219 del user_obj
        220 self.cfg.session_handler.after_auth(self, self.cfg.session_id_handler, self.user)
        self = <MoinMoin.request.request_cgi.Request object>
        self.user = None
        self._handle_auth_form = <bound method Request._handle_auth_form of <MoinMoin.request.request_cgi.Request object>>
        user_obj = None

    /usr/local/lib/python2.7/dist-packages/MoinMoin/request/__init__.py in _handle_auth_form (self=<MoinMoin.request.request_cgi.Request object>, user_obj=None)
        634 return self.handle_auth(user_obj, attended=True, username=username,
        635 password=password, login=login, logout=logout,
        636 stage=stage, openid_identifier=oid)
        637
        638 def handle_auth(self, user_obj, attended=False, **kw):
        stage = None
        openid_identifier undefined
        oid = None

    /usr/local/lib/python2.7/dist-packages/MoinMoin/request/__init__.py in handle_auth (self=<MoinMoin.request.request_cgi.Request object>, user_obj=None, attended=True, **kw={'login': False, 'logout': False, 'openid_identifier': None, 'password': None, 'stage': None, 'username': None})
        688 login_msgs.append(msg)
        689 else:
        690 user_obj, cont = authmethod.request(self, user_obj, **extra)
        691 if not cont:
        692 break
        user_obj = None
        cont undefined
        authmethod = <MoinMoin.auth.http.HTTPAuth instance>
        authmethod.request = <bound method HTTPAuth.request of <MoinMoin.auth.http.HTTPAuth instance>>
        self = <MoinMoin.request.request_cgi.Request object>
        extra = {'cookie': <SimpleCookie: >}

    /usr/local/lib/python2.7/dist-packages/MoinMoin/auth/http.py in request (self=<MoinMoin.auth.http.HTTPAuth instance>, request=<MoinMoin.request.request_cgi.Request object>, user_obj=None, **kw={'cookie': <SimpleCookie: >})
        75 # we don't use the moin user profile for those attributes.
        76 u = user.User(request, auth_username=username,
        77 auth_method=self.name, auth_attribs=('name', 'password'))
        78
        79 if u and self.autocreate:
        auth_method undefined
        self = <MoinMoin.auth.http.HTTPAuth instance>
        self.name = 'http'
        auth_attribs undefined

    /usr/local/lib/python2.7/dist-packages/MoinMoin/user.py in __init__ (self=<MoinMoin.user.User at 0x1305290 name:u'bapadmin' valid:0>, request=<MoinMoin.request.request_cgi.Request object>, id=None, name='', password=None, auth_username=u'bapadmin', **kw={'auth_attribs': ('name', 'password'), 'auth_method': 'http'})
        338 check_password = None
        339 if not self.id and self.auth_username:
        340 self.id = getUserId(request, self.auth_username)
        341 if not password is None:
        342 check_password = password
        self = <MoinMoin.user.User at 0x1305290 name:u'bapadmin' valid:0>
        self.id = <HIDDEN>
        global getUserId = <function getUserId>
        request = <MoinMoin.request.request_cgi.Request object>
        self.auth_username = u'bapadmin'

    /usr/local/lib/python2.7/dist-packages/MoinMoin/user.py in getUserId (request=<MoinMoin.request.request_cgi.Request object>, searchName=u'bapadmin')
        114 @return: the corresponding user ID or None
        115 """
        116 return _getUserIdByKey(request, 'name', searchName)
        117
        118
        global _getUserIdByKey = <function _getUserIdByKey>
        request = <MoinMoin.request.request_cgi.Request object>
        searchName = u'bapadmin'

    /usr/local/lib/python2.7/dist-packages/MoinMoin/user.py in _getUserIdByKey (request=<MoinMoin.request.request_cgi.Request object>, key='name', search=u'bapadmin')
        89 if uid is None:
        90 for userid in getUserList(request):
        91 u = User(request, id=userid)
        92 if hasattr(u, key):
        93 value = getattr(u, key)
        u = <MoinMoin.user.User at 0x1305cb0 name:u'swappler' valid:1>
        global User = <class MoinMoin.user.User>
        request = <MoinMoin.request.request_cgi.Request object>
        builtin id = <HIDDEN>
        userid = '1276886381.61.9632'

    /usr/local/lib/python2.7/dist-packages/MoinMoin/user.py in __init__ (self=<MoinMoin.user.User at 0x1305680 name:u'rdanek' valid:1>, request=<MoinMoin.request.request_cgi.Request object>, id='1276886381.61.9632', name='', password=None, auth_username='', **kw={})
        361 self.may = Default(self)
        362
        363 if self.language and not self.language in i18n.wikiLanguages():
        364 self.language = 'en'
        365
        self = <MoinMoin.user.User at 0x1305680 name:u'rdanek' valid:1>
        self.language = u'en'
        global i18n = <module 'MoinMoin.i18n' from '/usr/local/lib/python2.7/dist-packages/MoinMoin/i18n/__init__.pyc'>
        i18n.wikiLanguages = <function wikiLanguages>

Component selection

Details

MoinMoin Version

Release 1.8.2 (release)

OS and Version

Ubuntu 12

Python Version

Python 2.7.3 (/usr/bin/python)

Server Setup

Apache 2, CGI

Server Details

Platform: Linux bapwiki 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64

Language you are using the wiki in (set in the browser/UserPreferences)

en

Workaround

Check the permissions of the data/cache/wikiconfig/i18n directory and its contents. It's highly likely that it will be unreadable by the Web server user (such as www-data) and changing the permissions should eliminate the error.

Discussion

I'm pretty sure I saw the same error when upgrading a Wiki recently, but I think the following things were needed to make it go away:

  1. moin maint cleancache (which you've done)

  2. moin migration data

  3. touch moin.wsgi (for a mod_wsgi deployment, or restart the server)

The error itself doesn't make too much sense, either hinting at some kind of version mismatch or some old code being cached, but it's possible that the migration step is necessary. -- PaulBoddie 2012-11-04 22:04:34

Try and see what's in your data/cache/wikiconfig/i18n directory inside your Wiki installation. Perhaps check the permissions of that directory, if it exists, and the directories above it. It looks like the i18n initialisation cannot populate the i18n cache, and so you end up with the uninitialised list of languages. -- PaulBoddie 2012-11-08 23:37:46

Permissions was the trick. data/cache/wikiconfig/i18n/meta had root ownership, not www-data. Thanks so much Paul. 2024-04-19 15:39:44

Maybe I'll work up a patch for this. I saw it myself and spent a while wondering how it was even possible. Then we can all save a few days troubleshooting by getting a sensible error instead of this one. :-) -- PaulBoddie 2012-11-12 22:26:36

I have actually just experienced this again myself. I didn't see any problems with permissions at all, but I did find that after manually writing wikiconfig.py while in the middle of trying to see why Moin wouldn't read the language details, the problem just disappeared and the meta file got a lot bigger. Maybe there's some timestamp-related problem. -- PaulBoddie 2012-12-20 01:14:31

I experienced this again today, but the problem this time was probably some theme code I wrote which accesses MoinMoin.i18n at the class level (not in a method, but actually during the initialisation of a theme class). When using moin maint cleancache the code failed to get a value other than None for the languages, but this was most likely due to the theme class being initialised before a request had been created and initialised, and so the languages were still None at that point. To get round this, I deferred the language retrieval until the theme code needing the languages was called: by then, a request will have been made available and be properly initialised. -- PaulBoddie 2013-05-14 15:28:13

Plan


MoinMoin: MoinMoinBugs/argument of type 'NoneType' is not iterable (last edited 2013-05-14 15:28:13 by PaulBoddie)