comparison piecrust/app.py @ 271:12657039c436

internal: Re-use the cached resource directory.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 01 Mar 2015 09:06:32 -0800
parents 07b4b8484c0a
children 869a206facd5
comparison
equal deleted inserted replaced
270:935bf5682686 271:12657039c436
5 import hashlib 5 import hashlib
6 import logging 6 import logging
7 import collections 7 import collections
8 import yaml 8 import yaml
9 from werkzeug.utils import cached_property 9 from werkzeug.utils import cached_property
10 from piecrust import (APP_VERSION, 10 from piecrust import (
11 APP_VERSION, RESOURCES_DIR,
11 CACHE_DIR, TEMPLATES_DIR, ASSETS_DIR, 12 CACHE_DIR, TEMPLATES_DIR, ASSETS_DIR,
12 PLUGINS_DIR, THEME_DIR, 13 PLUGINS_DIR, THEME_DIR,
13 CONFIG_PATH, THEME_CONFIG_PATH, 14 CONFIG_PATH, THEME_CONFIG_PATH,
14 DEFAULT_FORMAT, DEFAULT_TEMPLATE_ENGINE, DEFAULT_POSTS_FS, 15 DEFAULT_FORMAT, DEFAULT_TEMPLATE_ENGINE, DEFAULT_POSTS_FS,
15 DEFAULT_DATE_FORMAT, DEFAULT_PLUGIN_SOURCE, DEFAULT_THEME_SOURCE) 16 DEFAULT_DATE_FORMAT, DEFAULT_PLUGIN_SOURCE, DEFAULT_THEME_SOURCE)
469 @cached_property 470 @cached_property
470 def theme_dir(self): 471 def theme_dir(self):
471 td = self._get_dir(THEME_DIR) 472 td = self._get_dir(THEME_DIR)
472 if td is not None: 473 if td is not None:
473 return td 474 return td
474 return os.path.join(os.path.dirname(__file__), 'resources', 'theme') 475 return os.path.join(RESOURCES_DIR, 'theme')
475 476
476 @cached_property 477 @cached_property
477 def cache_dir(self): 478 def cache_dir(self):
478 return os.path.join(self.root_dir, CACHE_DIR) 479 return os.path.join(self.root_dir, CACHE_DIR)
479 480