How sessions work in MoinMoin

Sessions in MoinMoin are implemented using a special session handler that can be configured in cfg.session_handler. By default, an instance of the class MoinMoin.session.DefaultSessionHandler is used for managing sessions.

Set this to a non-zero value to enable anonymous sessions (can be fractional) [hours].

If you run a wiki farm and you want to share the session cookie between farm wikis, you want to change cookie_domain and/or cookie_path.

If you want anonymous users to get session features (e.g. a trail), set anonymous_session_lifetime.

Replacing session storage

Should you wish to store session data somewhere other than the filesystem cache Moin uses, you can use the DefaultSessionHandler along with a different class descending from DefaultSessionData. See MoinMoin/session.py for more details.

It is also possible but not recommended to use a different session handler altogether.

Session example code

As an extension programmer, in order to use session variables, you can use request.session like a dict, values stored there are automatically saved and restored if a session is available. Some more advanced usage is possible, see MoinMoin.session.SessionData in the file MoinMoin/session.py.