diff 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
line wrap: on
line diff
--- a/piecrust/sources/base.py	Sat Nov 29 18:34:53 2014 -0800
+++ b/piecrust/sources/base.py	Sat Nov 29 20:51:30 2014 -0800
@@ -177,10 +177,12 @@
         if self._first_valid_path_index >= 0:
             return
         if self._first_valid_path_index == -1:
-            raise PageNotFoundError("No valid paths were found for page reference:" %
+            raise PageNotFoundError(
+                    "No valid paths were found for page reference: %s" %
                     self._page_ref)
 
         self._load()
+        self._first_valid_path_index = -1
         for i, path_info in enumerate(self._paths):
             if os.path.isfile(path_info[2]):
                 self._first_valid_path_index = i