Skip to content

Commit

Permalink
Merge pull request #232 from collective/maurits-keyerror-time-workflow
Browse files Browse the repository at this point in the history
Fix `KeyError: time` on import with workflow without `time` variable
  • Loading branch information
zopyx authored Nov 30, 2023
2 parents 58b2bc4 + 6c4586f commit 8e4c1cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
1.11 (unreleased)
-----------------

- Fix ``KeyError: time`` when importing content with a workflow that does not have the ``time`` variable.
[maurits]

- Allow to use fix_html_in_content_fields without applying the default html_fixer.
[pbauer]

Expand Down
7 changes: 4 additions & 3 deletions src/collective/exportimport/import_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,10 @@ def import_workflow_history(self, obj, item):
for key, value in workflow_history.items():
# The time needs to be deserialized
for history_item in value:
history_item["time"] = DateTime(
dateutil.parser.parse(history_item["time"])
)
if "time" in history_item:
history_item["time"] = DateTime(
dateutil.parser.parse(history_item["time"])
)
result[key] = value
if result:
obj.workflow_history = PersistentMapping(result.items())
Expand Down

0 comments on commit 8e4c1cf

Please sign in to comment.