openedx-learning 0.30.0__py2.py3-none-any.whl → 0.30.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.
@@ -2,4 +2,4 @@
2
2
  Open edX Learning ("Learning Core").
3
3
  """
4
4
 
5
- __version__ = "0.30.0"
5
+ __version__ = "0.30.1"
@@ -9,7 +9,7 @@ from openedx_learning.apps.authoring.backup_restore.zipper import LearningPackag
9
9
  from openedx_learning.apps.authoring.publishing.api import get_learning_package_by_key
10
10
 
11
11
 
12
- def create_zip_file(lp_key: str, path: str, user: UserType | None = None) -> None:
12
+ def create_zip_file(lp_key: str, path: str, user: UserType | None = None, origin_server: str | None = None) -> None:
13
13
  """
14
14
  Creates a dump zip file for the given learning package key at the given path.
15
15
  The zip file contains a TOML representation of the learning package and its contents.
@@ -17,7 +17,7 @@ def create_zip_file(lp_key: str, path: str, user: UserType | None = None) -> Non
17
17
  Can throw a NotFoundError at get_learning_package_by_key
18
18
  """
19
19
  learning_package = get_learning_package_by_key(lp_key)
20
- LearningPackageZipper(learning_package, user).create_zip(path)
20
+ LearningPackageZipper(learning_package, user, origin_server).create_zip(path)
21
21
 
22
22
 
23
23
  def load_learning_package(path: str, key: str | None = None, user: UserType | None = None) -> dict:
@@ -32,11 +32,18 @@ class Command(BaseCommand):
32
32
  help='The username of the user performing the backup operation.',
33
33
  default=None
34
34
  )
35
+ parser.add_argument(
36
+ '--origin_server',
37
+ type=str,
38
+ help='The origin server for the backup operation.',
39
+ default=None
40
+ )
35
41
 
36
42
  def handle(self, *args, **options):
37
43
  lp_key = options['lp_key']
38
44
  file_name = options['file_name']
39
45
  username = options['username']
46
+ origin_server = options['origin_server']
40
47
  if not file_name.lower().endswith(".zip"):
41
48
  raise CommandError("Output file name must end with .zip")
42
49
  try:
@@ -45,7 +52,7 @@ class Command(BaseCommand):
45
52
  if username:
46
53
  user = User.objects.get(username=username)
47
54
  start_time = time.time()
48
- create_zip_file(lp_key, file_name, user=user)
55
+ create_zip_file(lp_key, file_name, user=user, origin_server=origin_server)
49
56
  elapsed = time.time() - start_time
50
57
  message = f'{lp_key} written to {file_name} (create_zip_file: {elapsed:.2f} seconds)'
51
58
  self.stdout.write(self.style.SUCCESS(message))
@@ -88,9 +88,22 @@ class LearningPackageZipper:
88
88
  A class to handle the zipping of learning content for backup and restore.
89
89
  """
90
90
 
91
- def __init__(self, learning_package: LearningPackage, user: UserType | None = None):
91
+ def __init__(
92
+ self,
93
+ learning_package: LearningPackage,
94
+ user: UserType | None = None,
95
+ origin_server: str | None = None):
96
+ """
97
+ Initialize the LearningPackageZipper.
98
+
99
+ Args:
100
+ learning_package (LearningPackage): The learning package to zip.
101
+ user (UserType | None): The user initiating the backup.
102
+ origin_server (str | None): The origin server for the backup.
103
+ """
92
104
  self.learning_package = learning_package
93
105
  self.user = user
106
+ self.origin_server = origin_server
94
107
  self.folders_already_created: set[Path] = set()
95
108
  self.entities_filenames_already_created: set[str] = set()
96
109
  self.utc_now = datetime.now(tz=timezone.utc)
@@ -269,7 +282,9 @@ class LearningPackageZipper:
269
282
 
270
283
  with zipfile.ZipFile(path, "w", compression=zipfile.ZIP_DEFLATED) as zipf:
271
284
  # Add the package.toml file
272
- package_toml_content: str = toml_learning_package(self.learning_package, self.utc_now, user=self.user)
285
+ package_toml_content: str = toml_learning_package(
286
+ self.learning_package, self.utc_now, user=self.user, origin_server=self.origin_server
287
+ )
273
288
  self.add_file_to_zip(zipf, Path(TOML_PACKAGE_NAME), package_toml_content, self.learning_package.updated)
274
289
 
275
290
  # Add the entities directory
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openedx-learning
3
- Version: 0.30.0
3
+ Version: 0.30.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
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.12
20
20
  Requires-Python: >=3.11
21
21
  License-File: LICENSE.txt
22
22
  Requires-Dist: tomlkit
23
- Requires-Dist: Django
24
- Requires-Dist: edx-drf-extensions
23
+ Requires-Dist: djangorestframework<4.0
25
24
  Requires-Dist: celery
25
+ Requires-Dist: Django
26
26
  Requires-Dist: attrs
27
- Requires-Dist: djangorestframework<4.0
27
+ Requires-Dist: edx-drf-extensions
28
28
  Requires-Dist: rules<4.0
29
29
  Dynamic: author
30
30
  Dynamic: author-email
@@ -1,4 +1,4 @@
1
- openedx_learning/__init__.py,sha256=o42mWx5Mabaa6g0sWTlTd70RT0dVUFS_P2zFpUePyl0,69
1
+ openedx_learning/__init__.py,sha256=kMiAEA0yqVhIndXG4Qewan7mbU20wii2EFxiH6tGD1M,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
@@ -7,15 +7,15 @@ openedx_learning/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
7
7
  openedx_learning/apps/authoring/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  openedx_learning/apps/authoring/backup_restore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  openedx_learning/apps/authoring/backup_restore/admin.py,sha256=OnEixkOuysPRr-F6C_CMwPkiXawkqgSEF46n3yiUK0o,59
10
- openedx_learning/apps/authoring/backup_restore/api.py,sha256=TlQmb9VADDj8UlNjOczlwOfY8JVFfGyZ3UN5nluL9Tw,1243
10
+ openedx_learning/apps/authoring/backup_restore/api.py,sha256=jX6shgWLlPqBeHrhPq-r8IkN_0OizLXk0Pb0CxzNEPM,1292
11
11
  openedx_learning/apps/authoring/backup_restore/apps.py,sha256=UnExBA7jhd3qI30_87JMvzVhS_k82t89qDVKSMpvg_A,340
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=S3pxdsKmt-KeTaJlJBzZg0qKOmUOvhkSKP12N6dGguU,47171
15
+ openedx_learning/apps/authoring/backup_restore/zipper.py,sha256=TMwwqSy2hWJhWthR3e1Lt2s9q1hW96P1piopDRVTW-c,47665
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
- openedx_learning/apps/authoring/backup_restore/management/commands/lp_dump.py,sha256=6-8D1rnDajTAIJu1HZLayY87hTfMnkaumYgSmLWpiGE,2302
18
+ openedx_learning/apps/authoring/backup_restore/management/commands/lp_dump.py,sha256=kNr3luMjKrzxzGbJI7GiE9W0Wf_Kb8x6H71XsyGt6b4,2561
19
19
  openedx_learning/apps/authoring/backup_restore/management/commands/lp_load.py,sha256=z-glaYCulllcptqFbX5cb0UL_b9NslaaHK-0kOmPLa4,2205
20
20
  openedx_learning/apps/authoring/backup_restore/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  openedx_learning/apps/authoring/collections/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -106,7 +106,7 @@ openedx_learning/lib/fields.py,sha256=FwS2e5FYNGqbG9PJoDFvBsBlkfWCYbZ6G8BPAKbufL
106
106
  openedx_learning/lib/managers.py,sha256=-Q3gxalSqyPZ9Im4DTROW5tF8wVTZLlmfTe62_xmowY,1643
107
107
  openedx_learning/lib/test_utils.py,sha256=g3KLuepIZbaDBCsaj9711YuqyUx7LD4gXDcfNC-mWdc,527
108
108
  openedx_learning/lib/validators.py,sha256=iqEdEAvFV2tC7Ecssx69kjecpdU8nE87AlDJYrqrsnc,404
109
- openedx_learning-0.30.0.dist-info/licenses/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
109
+ openedx_learning-0.30.1.dist-info/licenses/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
110
110
  openedx_tagging/__init__.py,sha256=V9N8M7f9LYlAbA_DdPUsHzTnWjYRXKGa5qHw9P1JnNI,30
111
111
  openedx_tagging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
112
112
  openedx_tagging/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -162,7 +162,7 @@ openedx_tagging/core/tagging/rest_api/v1/serializers.py,sha256=0HQD_Jrf6-YpocYfz
162
162
  openedx_tagging/core/tagging/rest_api/v1/urls.py,sha256=dNUKCtUCx_YzrwlbEbpDfjGVQbb2QdJ1VuJCkladj6E,752
163
163
  openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=Hf92cy-tE767DE9FgsZcPKiCYrf5ihfETz8qGKBnuiU,36278
164
164
  openedx_tagging/core/tagging/rest_api/v1/views_import.py,sha256=kbHUPe5A6WaaJ3J1lFIcYCt876ecLNQfd19m7YYub6c,1470
165
- openedx_learning-0.30.0.dist-info/METADATA,sha256=UYSea814_Nu8TsAyHI-Gs2I-wT-zX6BWh1KHX0-3w-w,9372
166
- openedx_learning-0.30.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
167
- openedx_learning-0.30.0.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
168
- openedx_learning-0.30.0.dist-info/RECORD,,
165
+ openedx_learning-0.30.1.dist-info/METADATA,sha256=3HzP3Q78vbE3hQ9mdAHthzmp_9XtKeu_3XhgbLGKE0Q,9372
166
+ openedx_learning-0.30.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
167
+ openedx_learning-0.30.1.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
168
+ openedx_learning-0.30.1.dist-info/RECORD,,