diff piecrust/pipelines/records.py @ 979:45ad976712ec

tests: Big push to get the tests to pass again. - Lots of fixes everywhere in the code. - Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now. - Replace all `.md` test files with `.html` since now a auto-format extension always sets the format. - Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 29 Oct 2017 22:51:57 -0700
parents 448710d84121
children 8adc27285d93
line wrap: on
line diff
--- a/piecrust/pipelines/records.py	Sun Oct 29 22:46:41 2017 -0700
+++ b/piecrust/pipelines/records.py	Sun Oct 29 22:51:57 2017 -0700
@@ -113,10 +113,17 @@
             multi_record._record_version == MultiRecord.RECORD_VERSION)
 
 
-def load_records(path):
+def load_records(path, raise_errors=False):
     try:
         multi_record = MultiRecord.load(path)
+    except FileNotFoundError:
+        if raise_errors:
+            raise
+        logger.debug("No existing records found at: %s" % path)
+        multi_record = None
     except Exception as ex:
+        if raise_errors:
+            raise
         logger.debug("Error loading records from: %s" % path)
         logger.debug(ex)
         logger.debug("Will use empty records.")