Theme Subset
For several reasons, it may sometimes be useful to limit users to a choice of a subset of all the installed themes.
- Testing a newly developed or downloaded contributed theme.
- Sub-classing a theme to implement minor changes so it is easy to install updates made to the base theme.
This feature will allow wiki maintainers to restrict most users to a subset of installed themes by adding an entry to the wiki configuration file. User IDs listed in the superuser configuration parameter will have access to all installed themes. (An alternative is to implement another list of privileged users such as theme_testers = ['UserOne','UserTwo'].)
Add a new parameter to multiconfig.py that will negate the feature:
theme_list = []
Near line 426 in userform.py of Moin 1.5.8 replace the lines:
for theme in wikiutil.getPlugins('theme', self.request.cfg): options.append((theme, theme))
with:
if self.cfg.theme_list and self.request.user.name not in self.cfg.superuser: theme_list = self.cfg.theme_list else: theme_list = wikiutil.getPlugins('theme', self.request.cfg) for theme in theme_list: options.append((theme, theme))
Wiki maintainers wishing to implement the feature would add something like the following to wikiconfig.py:
theme_list = ['mytheme1','mytheme2']
Documentation for HelpOnConfiguration:
Variable Name |
Default |
Description |
theme_list |
[] |
List of themes for the Preferred Theme drop-down box on the User Preferences page. Users in superuser are not affected. |
Note that implementation of this feature could eliminate the need for the theme_force configuration parameter. Setting theme_list to one theme that is the same as theme-default effectively does the same thing.