1 # -*- coding: iso-8859-1 -*-
3 MoinMoin - Generic website theme.
5 @copyright: 2009+ Matthijs Kooijman
6 @license: GNU GPL, see COPYING for details.
8 This theme simply loads other themes, depending on the url requested.
10 To use this theme, set the default theme to 'proxy' and set the
11 configuration value 'proxy_theme_mapping' to a list of (prefix, themename)
12 tuples (which will be tested in order, so be sure to include a theme with
13 an empty prefix at the end). For example:
15 proxy_theme_mapping = [
16 ('/Site/', 'deadfoxjunction'),
20 The prefixes are matched against the page requested, so urls within
21 MoinMoin (and a trailing slash is included).
23 This theme does not currently play well with user-selectable themes, since
24 that would completely bypass the proxy plugin. For now it is probably best
25 to set the theme_force configuration variable.
28 from MoinMoin.theme import load_theme, ThemeNotFound
32 Usually, a theme plugin defines a Theme class, whose constructor is
33 called. Instead, we define a Theme function that calls the proper
36 for (prefix, theme) in context.cfg.proxy_theme_mapping:
37 if context.request.path.startswith(prefix):
38 return load_theme(context, theme)
40 raise ThemeNotFound("proxy_theme_mapping defines no theme for url: %s" % (context.request.path))
42 # vim: set sw=4 sts=4 expandtab: