changeset 837:ad8f48a31c62

assets: Fix crash when a page doesn't have assets.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 05 Feb 2017 22:52:01 -0800
parents dca51cd8147a
children 89a44af17062
files piecrust/data/assetor.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/data/assetor.py	Sun Feb 05 22:50:12 2017 -0800
+++ b/piecrust/data/assetor.py	Sun Feb 05 22:52:01 2017 -0800
@@ -64,9 +64,9 @@
     def _cacheAssets(self):
         if self._cache is not None:
             return
-            
+
         self._cache = dict(self.findAssets())
-        
+
     def findAssets(self):
         raise NotImplementedError()
 
@@ -84,7 +84,7 @@
         name, ext = os.path.splitext(self._page.path)
         assets_dir = name + ASSET_DIR_SUFFIX
         if not os.path.isdir(assets_dir):
-            return
+            return assets
 
         rel_assets_dir = os.path.relpath(assets_dir, self._page.app.root_dir)
         base_url = build_base_url(self._page.app, self._uri, rel_assets_dir)
@@ -103,9 +103,9 @@
         cpi = self._page.app.env.exec_info_stack.current_page_info
         if cpi is not None:
             cpi.render_ctx.current_pass_info.used_assets = True
-        
+
         return assets
-            
+
     def copyAssets(self, dest_dir):
         page_pathname, _ = os.path.splitext(self._page.path)
         in_assets_dir = page_pathname + ASSET_DIR_SUFFIX