Mercurial > piecrust2
comparison piecrust/themes/base.py @ 1157:40a40305c4e1
config: Support environment variables in theme directories.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 11 Jun 2019 15:14:20 -0700 |
parents | 8adc27285d93 |
children | 5762a0b821ac |
comparison
equal
deleted
inserted
replaced
1156:4ea64255eadf | 1157:40a40305c4e1 |
---|---|
32 theme = site_config.get('theme', None) | 32 theme = site_config.get('theme', None) |
33 if theme is None: | 33 if theme is None: |
34 return None | 34 return None |
35 | 35 |
36 # Get the list of directories in which themes are installed. | 36 # Get the list of directories in which themes are installed. |
37 from piecrust.pathutil import expandall | |
37 dirs = [] | 38 dirs = [] |
38 themes_dirs = site_config.get('themes_dirs', []) | 39 themes_dirs = site_config.get('themes_dirs', []) |
39 if isinstance(themes_dirs, str): | 40 if isinstance(themes_dirs, str): |
40 dirs.append(os.path.join(self.root_dir, | 41 dirs.append(os.path.join(self.root_dir, expandall(themes_dirs))) |
41 os.path.expanduser(themes_dirs))) | |
42 else: | 42 else: |
43 dirs += [os.path.join(self.root_dir, os.path.expanduser(p)) | 43 dirs += [os.path.join(self.root_dir, expandall(p)) |
44 for p in themes_dirs] | 44 for p in themes_dirs] |
45 | 45 |
46 # Add the default `themes` directory. | 46 # Add the default `themes` directory. |
47 default_themes_dir = os.path.join(self.root_dir, THEMES_DIR) | 47 default_themes_dir = os.path.join(self.root_dir, THEMES_DIR) |
48 if os.path.isdir(default_themes_dir): | 48 if os.path.isdir(default_themes_dir): |