Skip to content

Commit

Permalink
Fix writing error-file with separate JSON file export.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thet committed Oct 11, 2023
1 parent 2817af8 commit b9c96d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/collective/exportimport/export_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down

0 comments on commit b9c96d2

Please sign in to comment.