|
15 | 15 | from django.utils.translation import gettext_lazy as _ |
16 | 16 | from opaque_keys.edx.locator import LibraryLocator, LibraryLocatorV2 |
17 | 17 |
|
18 | | -from openedx.core.djangoapps.content_libraries.api import export_library_v2_to_zip |
| 18 | +from openedx.core.djangoapps.content_libraries.api import export_library_v2_to_dir |
19 | 19 | from xmodule.contentstore.django import contentstore |
20 | 20 | from xmodule.modulestore.django import modulestore |
21 | 21 | from xmodule.modulestore.xml_exporter import export_course_to_xml, export_library_to_xml |
@@ -84,16 +84,15 @@ def export_to_git(content_key, repo, user='', rdir=None): |
84 | 84 | # pylint: disable=too-many-statements |
85 | 85 |
|
86 | 86 | # Detect content type and select appropriate export function |
| 87 | + content_type_label = "library" |
87 | 88 | is_library_v2 = isinstance(content_key, LibraryLocatorV2) |
88 | 89 | if is_library_v2: |
89 | 90 | # V2 libraries use backup API with zip extraction |
90 | | - export_xml_func = export_library_v2_to_zip |
91 | | - content_type_label = "library" |
| 91 | + content_export_func = export_library_v2_to_dir |
92 | 92 | elif isinstance(content_key, LibraryLocator): |
93 | | - export_xml_func = export_library_to_xml |
94 | | - content_type_label = "library" |
| 93 | + content_export_func = export_library_to_xml |
95 | 94 | else: |
96 | | - export_xml_func = export_course_to_xml |
| 95 | + content_export_func = export_course_to_xml |
97 | 96 | content_type_label = "course" |
98 | 97 |
|
99 | 98 | if not GIT_REPO_EXPORT_DIR: |
@@ -160,10 +159,10 @@ def export_to_git(content_key, repo, user='', rdir=None): |
160 | 159 |
|
161 | 160 | try: |
162 | 161 | if is_library_v2: |
163 | | - export_xml_func(content_key, root_dir, content_dir, user) |
| 162 | + content_export_func(content_key, root_dir, content_dir, user) |
164 | 163 | else: |
165 | 164 | # V1 libraries and courses: use XML export (no user parameter) |
166 | | - export_xml_func(modulestore(), contentstore(), content_key, |
| 165 | + content_export_func(modulestore(), contentstore(), content_key, |
167 | 166 | root_dir, content_dir) |
168 | 167 | except (OSError, AttributeError) as ex: |
169 | 168 | log.exception('Failed to export %s', content_type_label) |
|
0 commit comments