comparison piecrust/baking/worker.py @ 663:3ceeca7bb71c

themes: Add support for a `--theme` argument to `chef`.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 01 Mar 2016 22:27:28 -0800
parents 27e3b3f05648
children 81d9c3a3a0b5
comparison
equal deleted inserted replaced
662:cbd5cdec0695 663:3ceeca7bb71c
13 13
14 logger = logging.getLogger(__name__) 14 logger = logging.getLogger(__name__)
15 15
16 16
17 class BakeWorkerContext(object): 17 class BakeWorkerContext(object):
18 def __init__(self, root_dir, sub_cache_dir, out_dir, 18 def __init__(self, root_dir, sub_cache_dir, out_dir, *,
19 previous_record_path=None, 19 previous_record_path=None,
20 config_variant=None, config_values=None, 20 config_variant=None, config_values=None,
21 force=False, debug=False): 21 force=False, debug=False, theme_site=False):
22 self.root_dir = root_dir 22 self.root_dir = root_dir
23 self.sub_cache_dir = sub_cache_dir 23 self.sub_cache_dir = sub_cache_dir
24 self.out_dir = out_dir 24 self.out_dir = out_dir
25 self.previous_record_path = previous_record_path 25 self.previous_record_path = previous_record_path
26 self.config_variant = config_variant 26 self.config_variant = config_variant
27 self.config_values = config_values 27 self.config_values = config_values
28 self.force = force 28 self.force = force
29 self.debug = debug 29 self.debug = debug
30 self.theme_site = theme_site
30 self.app = None 31 self.app = None
31 self.previous_record = None 32 self.previous_record = None
32 self.previous_record_index = None 33 self.previous_record_index = None
33 34
34 35
37 self.ctx = ctx 38 self.ctx = ctx
38 self.work_start_time = time.perf_counter() 39 self.work_start_time = time.perf_counter()
39 40
40 def initialize(self): 41 def initialize(self):
41 # Create the app local to this worker. 42 # Create the app local to this worker.
42 app = PieCrust(self.ctx.root_dir, debug=self.ctx.debug) 43 app = PieCrust(self.ctx.root_dir, debug=self.ctx.debug,
44 theme_site=self.ctx.theme_site)
43 app._useSubCacheDir(self.ctx.sub_cache_dir) 45 app._useSubCacheDir(self.ctx.sub_cache_dir)
44 app.config.set('baker/is_baking', True) 46 app.config.set('baker/is_baking', True)
45 app.config.set('baker/worker_id', self.wid) 47 app.config.set('baker/worker_id', self.wid)
46 app.env.base_asset_url_format = '%uri%' 48 app.env.base_asset_url_format = '%uri%'
47 app.env.fs_cache_only_for_main_page = True 49 app.env.fs_cache_only_for_main_page = True