Mercurial > piecrust2
diff piecrust/app.py @ 709:4285b2c9b872
themes: Add support for loading from a library of themes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 19 May 2016 22:11:27 -0700 |
parents | 894d286b348f |
children | ab5c6a8ae90a |
line wrap: on
line diff
--- a/piecrust/app.py Thu May 19 22:05:10 2016 -0700 +++ b/piecrust/app.py Thu May 19 22:11:27 2016 -0700 @@ -103,11 +103,23 @@ @cached_property def theme_dir(self): + # No theme if the curent site is already a theme. if self.theme_site: return None + + # See if there's a theme we absolutely want. td = self._get_dir(THEME_DIR) if td is not None: return td + + # Try to load a theme specified in the configuration. + from piecrust.themes.base import ThemeLoader + loader = ThemeLoader(self.root_dir) + theme_dir = loader.getThemeDir() + if theme_dir is not None: + return theme_dir + + # Nothing... use the default theme. return os.path.join(RESOURCES_DIR, 'theme') @cached_property