comparison 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
comparison
equal deleted inserted replaced
126:e5cba2622d26 127:bc63dc20baa0
206 ctx, rp = self._bakeSingle(page, sub_uri, cur_sub, out_path, 206 ctx, rp = self._bakeSingle(page, sub_uri, cur_sub, out_path,
207 pagination_filter, custom_data) 207 pagination_filter, custom_data)
208 except Exception as ex: 208 except Exception as ex:
209 if self.app.debug: 209 if self.app.debug:
210 logger.exception(ex) 210 logger.exception(ex)
211 raise BakingError("Error baking page '%s' for URL '%s'." % 211 page_rel_path = os.path.relpath(page.path, self.app.root_dir)
212 (page.ref_spec, uri)) from ex 212 raise BakingError("%s: error baking '%s'." %
213 (page_rel_path, uri)) from ex
213 214
214 # Copy page assets. 215 # Copy page assets.
215 if (cur_sub == 1 and self.copy_assets and 216 if (cur_sub == 1 and self.copy_assets and
216 ctx.used_assets is not None): 217 ctx.used_assets is not None):
217 if self.pretty_urls: 218 if self.pretty_urls:
262 263
263 return ctx, rp 264 return ctx, rp
264 265
265 266
266 class Baker(object): 267 class Baker(object):
267 def __init__(self, app, out_dir=None, force=False, portable=False, 268 def __init__(self, app, out_dir, force=False, portable=False,
268 no_assets=False, num_workers=4): 269 no_assets=False, num_workers=4):
270 assert app and out_dir
269 self.app = app 271 self.app = app
270 self.out_dir = out_dir or os.path.join(app.root_dir, '_counter') 272 self.out_dir = out_dir
271 self.force = force 273 self.force = force
272 self.portable = portable 274 self.portable = portable
273 self.no_assets = no_assets 275 self.no_assets = no_assets
274 self.num_workers = num_workers 276 self.num_workers = num_workers
275 277