Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/openedx_content/applets/backup_restore/zipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,12 @@ def _save_container(
for valid_published in containers.get(f"{type_code}_published", []):
entity_key = valid_published.pop("entity_key")
children = self._resolve_children(valid_published, children_map)
self.all_published_entities_versions.add(
(entity_key, valid_published.get('version_num'))
) # Track published version
version_num = valid_published.pop("version_num", None)
self.all_published_entities_versions.add((entity_key, version_num))
containers_api.create_next_container_version(
container_map[entity_key],
force_version_num=version_num,
**valid_published, # should this be allowed to override any of the following fields?
force_version_num=valid_published.pop("version_num", None),
entities=children,
created_by=self.user_id,
)
Expand Down
2 changes: 1 addition & 1 deletion src/openedx_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"""

# The version for the entire repository
__version__ = "0.39.2"
__version__ = "0.40.0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a bugfix, shouldn't this be 0.39.3?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The collection_code change is also released by this, which makes it a breaking release

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ created = 2025-09-04T22:51:59.271334Z
version_num = 2

[entity.published]
# unpublished: no published_version_num
version_num = 2

[entity.container.unit]

Expand Down
8 changes: 7 additions & 1 deletion tests/openedx_content/applets/backup_restore/test_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,19 @@ def verify_containers(self, lp):
published_version = publishing_api.get_published_version(container.publishable_entity.id)
assert container.created_by is not None
assert container.created_by.username == "lp_user"
# The unit has been published. The other two containers haven't been.
# It's important that we test with at least one published container in order to
# fully cover _create_container in zipper.py.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# fully cover _create_container in zipper.py.
# fully cover _save_container in zipper.py.

(I typo'd the function name)

if container.key == "unit1-b7eafb":
assert containers_api.get_container_type_code_of(container) == "unit"
assert draft_version is not None
assert draft_version.version_num == 2
assert draft_version.created_by is not None
assert draft_version.created_by.username == "lp_user"
assert published_version is None
assert published_version is not None
assert published_version.version_num == 2
assert published_version.created_by is not None
assert published_version.created_by.username == "lp_user"
elif container.key == "subsection1-48afa3":
assert containers_api.get_container_type_code_of(container) == "subsection"
assert draft_version is not None
Expand Down