-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
There was a problem hiding this 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
sqlalchemy_file/file.py
Outdated
content_path: Optional[str] = None, | ||
filename: Optional[str] = None, | ||
content_type: Optional[str] = None, | ||
**kwargs: Dict[str, Any], | ||
) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
sqlalchemy_file/file.py
Outdated
@@ -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, |
There was a problem hiding this comment.
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
I moved |
Thank you for your contribution 🎉, I will try to fix the formatting issue |
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.