comparison piecrust/sources/base.py @ 144:8d16ca75075f

Fix a bug with page references in cases of failure. Add unit tests.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 29 Nov 2014 20:51:30 -0800
parents 371a6c879ab9
children c3831a762bc2
comparison
equal deleted inserted replaced
143:5b12c1d96523 144:8d16ca75075f
175 175
176 def _checkPaths(self): 176 def _checkPaths(self):
177 if self._first_valid_path_index >= 0: 177 if self._first_valid_path_index >= 0:
178 return 178 return
179 if self._first_valid_path_index == -1: 179 if self._first_valid_path_index == -1:
180 raise PageNotFoundError("No valid paths were found for page reference:" % 180 raise PageNotFoundError(
181 "No valid paths were found for page reference: %s" %
181 self._page_ref) 182 self._page_ref)
182 183
183 self._load() 184 self._load()
185 self._first_valid_path_index = -1
184 for i, path_info in enumerate(self._paths): 186 for i, path_info in enumerate(self._paths):
185 if os.path.isfile(path_info[2]): 187 if os.path.isfile(path_info[2]):
186 self._first_valid_path_index = i 188 self._first_valid_path_index = i
187 break 189 break
188 190