changeset 839:b8f089092281

bug: Fix crashes for commands run outside of a website.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 15 Feb 2017 22:15:06 -0800
parents 89a44af17062
children 7f3043f9f26f
files piecrust/appconfig.py
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/appconfig.py	Sun Feb 05 22:54:08 2017 -0800
+++ b/piecrust/appconfig.py	Wed Feb 15 22:15:06 2017 -0800
@@ -97,11 +97,6 @@
             paths.append(self._path)
         paths += self._custom_paths
 
-        if len(paths) == 0:
-            raise ConfigurationError(
-                "No paths to load configuration from. "
-                "Specify paths, or set the values directly.")
-
         # Build the cache-key.
         path_times = [os.path.getmtime(p) for p in paths]
         cache_key_hash = hashlib.md5(
@@ -112,7 +107,7 @@
         cache_key = cache_key_hash.hexdigest()
 
         # Check the cache for a valid version.
-        if self._cache.isValid('config.json', path_times):
+        if path_times and self._cache.isValid('config.json', path_times):
             logger.debug("Loading configuration from cache...")
             config_text = self._cache.read('config.json')
             self._values = json.loads(