openedx-learning 0.29.0__py2.py3-none-any.whl → 0.29.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openedx_learning/__init__.py +1 -1
- openedx_learning/apps/authoring/backup_restore/zipper.py +22 -4
- {openedx_learning-0.29.0.dist-info → openedx_learning-0.29.1.dist-info}/METADATA +5 -5
- {openedx_learning-0.29.0.dist-info → openedx_learning-0.29.1.dist-info}/RECORD +7 -7
- {openedx_learning-0.29.0.dist-info → openedx_learning-0.29.1.dist-info}/WHEEL +0 -0
- {openedx_learning-0.29.0.dist-info → openedx_learning-0.29.1.dist-info}/licenses/LICENSE.txt +0 -0
- {openedx_learning-0.29.0.dist-info → openedx_learning-0.29.1.dist-info}/top_level.txt +0 -0
openedx_learning/__init__.py
CHANGED
|
@@ -47,6 +47,7 @@ from openedx_learning.apps.authoring.backup_restore.toml import (
|
|
|
47
47
|
)
|
|
48
48
|
from openedx_learning.apps.authoring.collections import api as collections_api
|
|
49
49
|
from openedx_learning.apps.authoring.components import api as components_api
|
|
50
|
+
from openedx_learning.apps.authoring.contents import api as contents_api
|
|
50
51
|
from openedx_learning.apps.authoring.publishing import api as publishing_api
|
|
51
52
|
from openedx_learning.apps.authoring.sections import api as sections_api
|
|
52
53
|
from openedx_learning.apps.authoring.subsections import api as subsections_api
|
|
@@ -493,6 +494,7 @@ class LearningPackageUnzipper:
|
|
|
493
494
|
self.zipf = zipf
|
|
494
495
|
self.user = user
|
|
495
496
|
self.lp_key = key # If provided, use this key for the restored learning package
|
|
497
|
+
self.learning_package_id: int | None = None # Will be set upon restoration
|
|
496
498
|
self.utc_now: datetime = datetime.now(timezone.utc)
|
|
497
499
|
self.component_types_cache: dict[tuple[str, str], ComponentType] = {}
|
|
498
500
|
self.errors: list[dict[str, Any]] = []
|
|
@@ -735,6 +737,7 @@ class LearningPackageUnzipper:
|
|
|
735
737
|
learning_package["key"] = self.lp_key
|
|
736
738
|
|
|
737
739
|
learning_package_obj = publishing_api.create_learning_package(**learning_package)
|
|
740
|
+
self.learning_package_id = learning_package_obj.id
|
|
738
741
|
|
|
739
742
|
with publishing_api.bulk_draft_changes_for(learning_package_obj.id):
|
|
740
743
|
self._save_components(learning_package_obj, components, component_static_files)
|
|
@@ -937,16 +940,31 @@ class LearningPackageUnzipper:
|
|
|
937
940
|
num_version: int,
|
|
938
941
|
entity_key: str,
|
|
939
942
|
static_files_map: dict[str, List[str]]
|
|
940
|
-
) -> dict[str, bytes]:
|
|
943
|
+
) -> dict[str, bytes | int]:
|
|
941
944
|
"""Resolve static file paths into their binary content."""
|
|
942
|
-
resolved_files: dict[str, bytes] = {}
|
|
945
|
+
resolved_files: dict[str, bytes | int] = {}
|
|
943
946
|
|
|
944
|
-
static_file_key = f"{entity_key}:v{num_version}" # e.g., "
|
|
947
|
+
static_file_key = f"{entity_key}:v{num_version}" # e.g., "xblock.v1:html:my_component_123456:v1"
|
|
948
|
+
block_type = entity_key.split(":")[1] # e.g., "html"
|
|
945
949
|
static_files = static_files_map.get(static_file_key, [])
|
|
946
950
|
for static_file in static_files:
|
|
947
951
|
local_key = static_file.split(f"v{num_version}/")[-1]
|
|
948
952
|
with self.zipf.open(static_file, "r") as f:
|
|
949
|
-
|
|
953
|
+
content_bytes = f.read()
|
|
954
|
+
if local_key == "block.xml":
|
|
955
|
+
# Special handling for block.xml to ensure
|
|
956
|
+
# storing the value as a content instance
|
|
957
|
+
if not self.learning_package_id:
|
|
958
|
+
raise ValueError("learning_package_id must be set before resolving static files.")
|
|
959
|
+
text_content = contents_api.get_or_create_text_content(
|
|
960
|
+
self.learning_package_id,
|
|
961
|
+
contents_api.get_or_create_media_type(f"application/vnd.openedx.xblock.v1.{block_type}+xml").id,
|
|
962
|
+
text=content_bytes.decode("utf-8"),
|
|
963
|
+
created=self.utc_now,
|
|
964
|
+
)
|
|
965
|
+
resolved_files[local_key] = text_content.id
|
|
966
|
+
else:
|
|
967
|
+
resolved_files[local_key] = content_bytes
|
|
950
968
|
return resolved_files
|
|
951
969
|
|
|
952
970
|
def _resolve_children(self, entity_data: dict[str, Any], lookup_map: dict[str, Any]) -> list[Any]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openedx-learning
|
|
3
|
-
Version: 0.29.
|
|
3
|
+
Version: 0.29.1
|
|
4
4
|
Summary: Open edX Learning Core and Tagging.
|
|
5
5
|
Home-page: https://github.com/openedx/openedx-learning
|
|
6
6
|
Author: David Ormsbee
|
|
@@ -19,13 +19,13 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Requires-Python: >=3.11
|
|
21
21
|
License-File: LICENSE.txt
|
|
22
|
-
Requires-Dist:
|
|
22
|
+
Requires-Dist: rules<4.0
|
|
23
23
|
Requires-Dist: edx-drf-extensions
|
|
24
|
+
Requires-Dist: Django
|
|
25
|
+
Requires-Dist: tomlkit
|
|
26
|
+
Requires-Dist: djangorestframework<4.0
|
|
24
27
|
Requires-Dist: attrs
|
|
25
28
|
Requires-Dist: celery
|
|
26
|
-
Requires-Dist: tomlkit
|
|
27
|
-
Requires-Dist: rules<4.0
|
|
28
|
-
Requires-Dist: Django
|
|
29
29
|
Dynamic: author
|
|
30
30
|
Dynamic: author-email
|
|
31
31
|
Dynamic: classifier
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
openedx_learning/__init__.py,sha256=
|
|
1
|
+
openedx_learning/__init__.py,sha256=Z6oFsZrI2xFIXJ8CCTDE4l0MUEFWwTjOpo6C06gHz0U,69
|
|
2
2
|
openedx_learning/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
openedx_learning/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
openedx_learning/api/authoring.py,sha256=EDWTY_JDKtjD9nFrrijzWuVccs3LZeDLEdzTUNanR4I,1111
|
|
@@ -12,7 +12,7 @@ openedx_learning/apps/authoring/backup_restore/apps.py,sha256=UnExBA7jhd3qI30_87
|
|
|
12
12
|
openedx_learning/apps/authoring/backup_restore/models.py,sha256=jlr0ppxW0IOW3HPHoJNChHvDrYVnKMb5_3uC2itxqQk,45
|
|
13
13
|
openedx_learning/apps/authoring/backup_restore/serializers.py,sha256=LBWrlWmA0Aok-XSfwiGBqNTU-1ig4hnEX_AxFaAjaoY,6487
|
|
14
14
|
openedx_learning/apps/authoring/backup_restore/toml.py,sha256=4QFKDoFXsEF3xr1gvRXKQien-4_GezH6Gn1BdYQF8yU,8286
|
|
15
|
-
openedx_learning/apps/authoring/backup_restore/zipper.py,sha256=
|
|
15
|
+
openedx_learning/apps/authoring/backup_restore/zipper.py,sha256=S3pxdsKmt-KeTaJlJBzZg0qKOmUOvhkSKP12N6dGguU,47171
|
|
16
16
|
openedx_learning/apps/authoring/backup_restore/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
openedx_learning/apps/authoring/backup_restore/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
openedx_learning/apps/authoring/backup_restore/management/commands/lp_dump.py,sha256=6-8D1rnDajTAIJu1HZLayY87hTfMnkaumYgSmLWpiGE,2302
|
|
@@ -104,7 +104,7 @@ openedx_learning/lib/fields.py,sha256=eiGoXMPhRuq25EH2qf6BAODshAQE3DBVdIYAMIUAXW
|
|
|
104
104
|
openedx_learning/lib/managers.py,sha256=-Q3gxalSqyPZ9Im4DTROW5tF8wVTZLlmfTe62_xmowY,1643
|
|
105
105
|
openedx_learning/lib/test_utils.py,sha256=g3KLuepIZbaDBCsaj9711YuqyUx7LD4gXDcfNC-mWdc,527
|
|
106
106
|
openedx_learning/lib/validators.py,sha256=iqEdEAvFV2tC7Ecssx69kjecpdU8nE87AlDJYrqrsnc,404
|
|
107
|
-
openedx_learning-0.29.
|
|
107
|
+
openedx_learning-0.29.1.dist-info/licenses/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
|
|
108
108
|
openedx_tagging/__init__.py,sha256=V9N8M7f9LYlAbA_DdPUsHzTnWjYRXKGa5qHw9P1JnNI,30
|
|
109
109
|
openedx_tagging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
110
110
|
openedx_tagging/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -160,7 +160,7 @@ openedx_tagging/core/tagging/rest_api/v1/serializers.py,sha256=0HQD_Jrf6-YpocYfz
|
|
|
160
160
|
openedx_tagging/core/tagging/rest_api/v1/urls.py,sha256=dNUKCtUCx_YzrwlbEbpDfjGVQbb2QdJ1VuJCkladj6E,752
|
|
161
161
|
openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=Hf92cy-tE767DE9FgsZcPKiCYrf5ihfETz8qGKBnuiU,36278
|
|
162
162
|
openedx_tagging/core/tagging/rest_api/v1/views_import.py,sha256=kbHUPe5A6WaaJ3J1lFIcYCt876ecLNQfd19m7YYub6c,1470
|
|
163
|
-
openedx_learning-0.29.
|
|
164
|
-
openedx_learning-0.29.
|
|
165
|
-
openedx_learning-0.29.
|
|
166
|
-
openedx_learning-0.29.
|
|
163
|
+
openedx_learning-0.29.1.dist-info/METADATA,sha256=T9KZOwk1jrSCv47Qy-9TsC4lFxjVcKg3oNAX0K2Vz7w,9372
|
|
164
|
+
openedx_learning-0.29.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
165
|
+
openedx_learning-0.29.1.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
|
|
166
|
+
openedx_learning-0.29.1.dist-info/RECORD,,
|
|
File without changes
|
{openedx_learning-0.29.0.dist-info → openedx_learning-0.29.1.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|