Mercurial > piecrust2
comparison piecrust/app.py @ 848:7d83b9484b98
plugins: Add support for "ad-hoc" local plugins.
These are loose `.py` files inside of the `plugins` folder of a website.
They're loaded along with other normal (packaged) plugins.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 27 Apr 2017 20:54:29 -0700 |
parents | 69d16e1afb95 |
children | 4850f8c21b6e 46025a1b5434 |
comparison
equal
deleted
inserted
replaced
847:71c4f43d8fc1 | 848:7d83b9484b98 |
---|---|
5 import urllib.parse | 5 import urllib.parse |
6 from werkzeug.utils import cached_property | 6 from werkzeug.utils import cached_property |
7 from piecrust import ( | 7 from piecrust import ( |
8 RESOURCES_DIR, | 8 RESOURCES_DIR, |
9 CACHE_DIR, TEMPLATES_DIR, ASSETS_DIR, | 9 CACHE_DIR, TEMPLATES_DIR, ASSETS_DIR, |
10 THEME_DIR, | 10 THEME_DIR, PLUGINS_DIR, |
11 CONFIG_PATH, THEME_CONFIG_PATH) | 11 CONFIG_PATH, THEME_CONFIG_PATH) |
12 from piecrust.appconfig import PieCrustConfiguration | 12 from piecrust.appconfig import PieCrustConfiguration |
13 from piecrust.cache import ExtensibleCache, NullExtensibleCache | 13 from piecrust.cache import ExtensibleCache, NullExtensibleCache |
14 from piecrust.configuration import ConfigurationError, merge_dicts | 14 from piecrust.configuration import ConfigurationError, merge_dicts |
15 from piecrust.environment import StandardEnvironment | 15 from piecrust.environment import StandardEnvironment |
123 if theme_dir is not None: | 123 if theme_dir is not None: |
124 return theme_dir | 124 return theme_dir |
125 | 125 |
126 # Nothing... use the default theme. | 126 # Nothing... use the default theme. |
127 return os.path.join(RESOURCES_DIR, 'theme') | 127 return os.path.join(RESOURCES_DIR, 'theme') |
128 | |
129 @cached_property | |
130 def plugins_dir(self): | |
131 return self._get_dir(PLUGINS_DIR) | |
128 | 132 |
129 @cached_property | 133 @cached_property |
130 def cache_dir(self): | 134 def cache_dir(self): |
131 return os.path.join(self.root_dir, CACHE_DIR, self.cache_key) | 135 return os.path.join(self.root_dir, CACHE_DIR, self.cache_key) |
132 | 136 |