diff --git a/CHANGES.rst b/CHANGES.rst index 742a3d70..84602ed1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,9 @@ Changelog 1.11 (unreleased) ----------------- -- Nothing changed yet. +- When exporting into separate JSON files write also the error in a separate errors.json file. + This fixes an error at the end of the export and no errors being written. + [thet] 1.10 (2023-10-11) diff --git a/src/collective/exportimport/export_content.py b/src/collective/exportimport/export_content.py index 089e0ebe..77e79c2a 100644 --- a/src/collective/exportimport/export_content.py +++ b/src/collective/exportimport/export_content.py @@ -208,7 +208,8 @@ def __call__( if number: if self.errors and self.write_errors: errors = {"unexported_paths": self.errors} - json.dump(errors, f, indent=4) + with open(os.path.join(directory, "errors.json"), "w") as f: + json.dump(errors, f, indent=4) msg = _(u"Exported {} items ({}) to {} with {} errors").format( number, ", ".join(self.portal_type), directory, len(self.errors) )