Skip to content

Commit ab2af32

Browse files
committed
chore: fix lint errors
1 parent 510b266 commit ab2af32

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

openedx/core/djangoapps/content_libraries/api/libraries.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,11 @@ def revert_changes(library_key: LibraryLocatorV2, user_id: int | None = None) ->
692692
tasks.wait_for_post_revert_events(draft_change_log, library_key)
693693

694694

695-
def get_backup_task_status(library_key: LibraryLocatorV2, user_id: int | None = None, task_id: str | None = None) -> dict | None:
695+
def get_backup_task_status(
696+
library_key: LibraryLocatorV2,
697+
user_id: int | None = None,
698+
task_id: str | None = None
699+
) -> dict | None:
696700
"""
697701
Get the status of a library backup task.
698702
@@ -704,7 +708,10 @@ def get_backup_task_status(library_key: LibraryLocatorV2, user_id: int | None =
704708
task_status = None
705709
if not task_id:
706710
# Get the latest task for this user and library
707-
task_status = UserTaskStatus.objects.filter(user_id=user_id, name__contains=str(library_key)).order_by('-created').first()
711+
task_status = UserTaskStatus.objects.filter(
712+
user_id=user_id,
713+
name__contains=str(library_key)
714+
).order_by('-created').first()
708715
else:
709716
# Get the specific task by ID
710717
task_status = UserTaskStatus.objects.get(task_id=task_id, user_id=user_id)

openedx/core/djangoapps/content_libraries/tasks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,15 +531,14 @@ def backup_library(self, user_id: int, library_key_str: str) -> None:
531531
root_dir = Path(mkdtemp())
532532
filename = f'library-{str(library_key)}.zip'
533533
file_path = os.path.join(root_dir, filename)
534-
create_lib_zip_file(lp_key=library_key, path=file_path)
534+
create_lib_zip_file(lp_key=str(library_key), path=file_path)
535535
set_custom_attribute("exporting_completed", str(library_key))
536536

537537
with open(file_path, 'rb') as zipfile:
538538
artifact = UserTaskArtifact(status=self.status, name='Output')
539539
artifact.file.save(name=os.path.basename(zipfile.name), content=File(zipfile))
540540
artifact.save()
541-
except Exception as exception:
541+
except Exception as exception: # pylint: disable=broad-except
542542
TASK_LOGGER.exception('Error exporting course %s', library_key, exc_info=True)
543543
if self.status.state != UserTaskStatus.FAILED:
544544
self.status.fail({'raw_error_msg': str(exception)})
545-
return

0 commit comments

Comments
 (0)