Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to upload files by path #87

Merged
merged 4 commits into from
Sep 7, 2023
Merged

Conversation

adscib
Copy link
Contributor

@adscib adscib commented Jul 21, 2023

This avoids having to load files into memory. I've been running this in production for some time now without issues, but it's certainly possible that this change breaks some behavior I'm not using, in particular when using positional arguments for File constructor. Let me know what you think.

Copy link
Owner

@jowilf jowilf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! Your changes are looking good; we just need to ensure backward compatibility, verify that the content_path works with the ThumbnailGenerator, and add some tests

Comment on lines 46 to 50
content_path: Optional[str] = None,
filename: Optional[str] = None,
content_type: Optional[str] = None,
**kwargs: Dict[str, Any],
) -> None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
content_path: Optional[str] = None,
filename: Optional[str] = None,
content_type: Optional[str] = None,
**kwargs: Dict[str, Any],
) -> None:
filename: Optional[str] = None,
content_type: Optional[str] = None,
content_path: Optional[str] = None,
**kwargs: Dict[str, Any],
) -> None:

It might be better to move the content_path parameter down. This way, existing calls to the function won't break

@@ -118,6 +130,7 @@ def save_to_storage(self, upload_storage: Optional[str] = None) -> None:
def store_content(
self,
content: Any,
content_path: Optional[str] = None,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to move the content_path parameter down. This way, existing calls to the function won't break

@adscib
Copy link
Contributor Author

adscib commented Sep 7, 2023

I moved content_path to the end and added a test. I'm not familiar with the formatting checkers you're using, so I don't know what's up with that.

@jowilf
Copy link
Owner

jowilf commented Sep 7, 2023

Thank you for your contribution 🎉, I will try to fix the formatting issue

@jowilf jowilf merged commit 0e2887a into jowilf:main Sep 7, 2023
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants