Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
708:d3a5a086e5cd | 709:4285b2c9b872 |
---|---|
101 | 101 |
102 return templates_dirs | 102 return templates_dirs |
103 | 103 |
104 @cached_property | 104 @cached_property |
105 def theme_dir(self): | 105 def theme_dir(self): |
106 # No theme if the curent site is already a theme. | |
106 if self.theme_site: | 107 if self.theme_site: |
107 return None | 108 return None |
109 | |
110 # See if there's a theme we absolutely want. | |
108 td = self._get_dir(THEME_DIR) | 111 td = self._get_dir(THEME_DIR) |
109 if td is not None: | 112 if td is not None: |
110 return td | 113 return td |
114 | |
115 # Try to load a theme specified in the configuration. | |
116 from piecrust.themes.base import ThemeLoader | |
117 loader = ThemeLoader(self.root_dir) | |
118 theme_dir = loader.getThemeDir() | |
119 if theme_dir is not None: | |
120 return theme_dir | |
121 | |
122 # Nothing... use the default theme. | |
111 return os.path.join(RESOURCES_DIR, 'theme') | 123 return os.path.join(RESOURCES_DIR, 'theme') |
112 | 124 |
113 @cached_property | 125 @cached_property |
114 def cache_dir(self): | 126 def cache_dir(self): |
115 return os.path.join(self.root_dir, CACHE_DIR, self.cache_key) | 127 return os.path.join(self.root_dir, CACHE_DIR, self.cache_key) |