Given a theme directory, extract important theme information.
"""
# open config
- config = ConfigObj(os.path.join(theme_dir, 'theme.ini'))
+ config = ConfigObj(os.path.join(theme_dir, 'theme.ini')).get('theme', {})
templates_dir = os.path.join(theme_dir, 'templates')
if not os.path.exists(templates_dir):
themedata = {
'name': config.get('name', name),
'description': config.get('description'),
+ 'licensing': config.get('licensing'),
'dir': theme_dir,
'templates_dir': templates_dir,
'assets_dir': assets_dir,
registry[themedir] = themedata
# Built-in themes
- _install_themes_in_dir(builtin_dir)
+ if os.path.exists(builtin_dir):
+ _install_themes_in_dir(builtin_dir)
# Installed themes
theme_install_dir = app_config.get('theme_install_dir')
if theme_install_dir and os.path.exists(theme_install_dir):
_install_themes_in_dir(theme_install_dir)
- return registry
+ current_theme_name = app_config.get('theme')
+ if current_theme_name \
+ and registry.has_key(current_theme_name):
+ current_theme = registry[current_theme_name]
+ else:
+ current_theme = None
+
+ return registry, current_theme
+