diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-16 04:49:06 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-16 04:49:06 +0100 |
commit | 411d07eaa2cd72147b280b41ed95892009e0292e (patch) | |
tree | 5bf6324020236e8eb0e34e45a4c43082e5138f1c /pyblackbird_cc/resources/views.py | |
parent | 96af6c6a9df9fe90b0aed141c0ad7b10ae97bee4 (diff) |
Cleans up a few LSP errors
Diffstat (limited to 'pyblackbird_cc/resources/views.py')
-rw-r--r-- | pyblackbird_cc/resources/views.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py index e96e701..91f2728 100644 --- a/pyblackbird_cc/resources/views.py +++ b/pyblackbird_cc/resources/views.py @@ -94,8 +94,8 @@ def _extract_metadata_from_resource(resource_obj) -> ResourceInfo | None: created=resource_obj.created_at, updated=resource_obj.updated_at, ) - except Exception as e: - logging.exception(f"Error extracting resource information: {e}") + except Exception: + logging.exception("Error extracting resource information") return None @@ -123,7 +123,7 @@ def get_presigned_obj_url(bucket_name, obj_name, expiration=3600) -> str | None: ExpiresIn=expiration, ) except ClientError as e: - logger.error(e) + logger.exception("Error generating presigned URL", extra={"error": e}) return None return response @@ -140,14 +140,14 @@ def upload_to_s3(pdf_files, thumbnail_files, snappedshotted_pages) -> bool: try: for pdf_file in pdf_files: - logger.info(f"Uploading {pdf_file.name} to S3") + logger.info("Uploading {pdf_file.name} to S3") client.upload_fileobj( pdf_file, settings.AWS_STORAGE_BUCKET_NAME, f"pdfuploads/{pdf_file.name}", ) for f in thumbnail_files: - logger.info(f"Uploading {f.name} to S3") + logger.info("Uploading {f.name} to S3") client.upload_fileobj( f, settings.AWS_STORAGE_BUCKET_NAME, @@ -155,7 +155,7 @@ def upload_to_s3(pdf_files, thumbnail_files, snappedshotted_pages) -> bool: ) if len(snappedshotted_pages[0]) == 1: for img in snappedshotted_pages[0]: - logger.info(f"Uploading {img} to S3") + logger.info("Uploading {img} to S3") client.upload_file( img, settings.AWS_STORAGE_BUCKET_NAME, @@ -164,15 +164,15 @@ def upload_to_s3(pdf_files, thumbnail_files, snappedshotted_pages) -> bool: else: for lst in snappedshotted_pages: for img in lst: - logger.info(f"Uploading {img} to S3") + logger.info("Uploading {img} to S3") client.upload_file( img, settings.AWS_STORAGE_BUCKET_NAME, f"snapshotted_pages/{os.path.basename(img)}", ) return True - except ClientError as e: - logging.exception(f"Error uploading files to S3: {e}") + except ClientError: + logging.exception("Error uploading files to S3") return False @@ -280,8 +280,8 @@ def create_resource(request): raise Exception("Error uploading files to S3") return redirect("resources:resource_detail", resource_id=resource.id) - except Exception as e: - logger.error(f"Error creating resource: {e}") + except Exception: + logger.exception("Error creating resource") form.add_error(None, "An error occurred while creating the resource.") else: # extract form errors |