-
Notifications
You must be signed in to change notification settings - Fork 17
Add PublishableEntities and PublishableEntityVersions to lp_dump file #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PublishableEntities and PublishableEntityVersions to lp_dump file #340
Conversation
|
Thanks for the pull request, @dwong2708! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
34527b7 to
123ad6a
Compare
fffd5c2 to
964bb83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to dump learning packages with their publishable entities to a ZIP file containing TOML representations. The implementation introduces a modular architecture for ZIP file creation and TOML generation.
- Added ZIP file creation with publishable entities as individual TOML files
- Introduced a mixin pattern for TOML generation with reusable components
- Created comprehensive test coverage for the dump functionality
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| openedx_learning/apps/authoring/backup_restore/zipper.py | New module implementing ZIP file creation with learning package and entity data |
| openedx_learning/apps/authoring/backup_restore/toml.py | Added TOMLPublishableEntityFile class and TOMLMixin for reusable TOML generation |
| openedx_learning/apps/authoring/backup_restore/api.py | Refactored to use new zipper module instead of inline ZIP creation |
| openedx_learning/apps/authoring/backup_restore/management/commands/lp_dump.py | Removed redundant logging in exception handler |
| openedx_learning/apps/authoring/publishing/models/publishable_entity.py | Added can_stand_alone property to PublishableEntityVersioning |
| tests/openedx_learning/apps/authoring/backup_restore/test_backup.py | New comprehensive test suite for backup functionality |
| test_settings.py | Added BackupRestoreConfig to installed apps |
| openedx_learning/api/authoring.py | Exposed backup_restore API functions |
tests/openedx_learning/apps/authoring/backup_restore/test_backup.py
Outdated
Show resolved
Hide resolved
cd89fae to
85aa808
Compare
|
Hi @ormsbee. I’m done with this task. Please let me know if it meets the requirements when you have a chance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a blocker for this PR, but I'm not clear on why it's necessary to create mixins and classes for the TOML conversion of the data. It seems like it would be simpler to declare them as simple functions that take what the constructor took and returns the TOML document object.
| Adds a comment with the current datetime to indicate when the export occurred. | ||
| This helps with traceability and file versioning. | ||
| Adds a newline to the TOML document. | ||
| This is useful for formatting the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear on why this class exists. These small methods only seem to echo into the TOMLDocument object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically yes. The idea was to act as a sort of interface (it didn’t quite work out that way, but that was the intention) in case we ever wanted to switch from TOML to YAML or another format. However, I agree with you—keeping it simple is better. I don't think we'll need to support other formats, so I can convert this into simple functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was changed to functions
| if comment_text: | ||
| section.add(comment(comment_text)) | ||
| for key, value in params.items(): | ||
| section.add(key, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this equivalent to:
section = table()
section.update(params)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about this method. I'll change it. Thanks Dave.
1e9bcdd to
d4b31f0
Compare
Resolves: #332
Description
This PR introduces the following changes:
zipper.pymodule to handle all ZIP file–related operations.TOMLPublishableEntityFileclass to abstract TOML file generation for a publishable entity.TOMLPublishableEntityVersionFileclass to abstract TOML file generation for a publishable entity version.TOMLMixinclass to encapsulate and reuse common TOML-related methods.Resulting Dump File
Suggestion
Given the entity key
xblock.v1:html:Query Counting, the TOML file currently uses this string as-is, which isn't ideal for a filename.I suggest transforming it into a slugified format—for example:
xblock-v1-html-query-counting—to make it more suitable as a filename.Content of the Entity File