comparison piecrust/baking/baker.py @ 49:fce061f8c2ed

Fix cache validation issue with rendered segments, limit disk access.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 22 Aug 2014 20:26:05 -0700
parents efd0d3bacc9e
children 2fec3ee1298f
comparison
equal deleted inserted replaced
48:002fa58f54dc 49:fce061f8c2ed
125 125
126 # Check for up-to-date outputs. 126 # Check for up-to-date outputs.
127 do_bake = True 127 do_bake = True
128 if not self.force and prev_record_entry: 128 if not self.force and prev_record_entry:
129 try: 129 try:
130 in_path_time = os.path.getmtime(page.path) 130 in_path_time = page.path_mtime
131 out_path_time = os.path.getmtime(out_path) 131 out_path_time = os.path.getmtime(out_path)
132 if out_path_time > in_path_time: 132 if out_path_time > in_path_time:
133 do_bake = False 133 do_bake = False
134 except OSError: 134 except OSError:
135 # File doesn't exist, we'll need to bake. 135 # File doesn't exist, we'll need to bake.
155 try: 155 try:
156 logger.debug(" p%d -> %s" % (cur_sub, out_path)) 156 logger.debug(" p%d -> %s" % (cur_sub, out_path))
157 ctx, rp = self._bakeSingle(page, sub_uri, cur_sub, out_path, 157 ctx, rp = self._bakeSingle(page, sub_uri, cur_sub, out_path,
158 pagination_filter, custom_data) 158 pagination_filter, custom_data)
159 except Exception as ex: 159 except Exception as ex:
160 if self.app.debug:
161 logger.exception(ex)
160 raise Exception("Error baking page '%s' for URL '%s'." % 162 raise Exception("Error baking page '%s' for URL '%s'." %
161 (page.ref_spec, uri)) from ex 163 (page.ref_spec, uri)) from ex
162 164
163 # Copy page assets. 165 # Copy page assets.
164 if (cur_sub == 1 and self.copy_assets and 166 if (cur_sub == 1 and self.copy_assets and