diff piecrust/baking/baker.py @ 127:bc63dc20baa0

Fix how we pass the out directory to the baking modules.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 14 Nov 2014 22:47:18 +0100
parents 133845647083
children 9e4c2e68a129
line wrap: on
line diff
--- a/piecrust/baking/baker.py	Fri Nov 14 22:46:16 2014 +0100
+++ b/piecrust/baking/baker.py	Fri Nov 14 22:47:18 2014 +0100
@@ -208,8 +208,9 @@
             except Exception as ex:
                 if self.app.debug:
                     logger.exception(ex)
-                raise BakingError("Error baking page '%s' for URL '%s'." %
-                        (page.ref_spec, uri)) from ex
+                page_rel_path = os.path.relpath(page.path, self.app.root_dir)
+                raise BakingError("%s: error baking '%s'." %
+                        (page_rel_path, uri)) from ex
 
             # Copy page assets.
             if (cur_sub == 1 and self.copy_assets and
@@ -264,10 +265,11 @@
 
 
 class Baker(object):
-    def __init__(self, app, out_dir=None, force=False, portable=False,
+    def __init__(self, app, out_dir, force=False, portable=False,
             no_assets=False, num_workers=4):
+        assert app and out_dir
         self.app = app
-        self.out_dir = out_dir or os.path.join(app.root_dir, '_counter')
+        self.out_dir = out_dir
         self.force = force
         self.portable = portable
         self.no_assets = no_assets