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 support for file_bytes argument with managed_file_context() #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bosd
Copy link
Collaborator

@bosd bosd commented Mar 26, 2024

This is an attempt to cherry-pick in the PR from #15.

Was really fighting with git and the merge commits on the fork of a fork and so on...
Cherry pick approach was the cleanest.

I hope to have solved the merge conflicts correctly.
Please review..

@bosd bosd force-pushed the Johnmaras-file-bytes-support2 branch 7 times, most recently from b605099 to 3a86892 Compare March 27, 2024 10:26
camelot/handlers.py Outdated Show resolved Hide resolved
@bosd bosd force-pushed the Johnmaras-file-bytes-support2 branch 6 times, most recently from ee162a5 to 70af652 Compare March 27, 2024 22:05
@bosd bosd force-pushed the Johnmaras-file-bytes-support2 branch from 70af652 to e445899 Compare March 27, 2024 22:14
@bosd bosd marked this pull request as ready for review March 27, 2024 22:20
@bosd bosd requested a review from foarsitter April 3, 2024 06:01
Copy link
Collaborator

@foarsitter foarsitter left a comment

Choose a reason for hiding this comment

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

Some of my thoughts:

  1. Adding the extra variable file_bytes feels for me more like an extra type for filepath.
  2. In __init__ there are two places where we raise an InvalidArguments
  3. filepath isn't used beyond open(self.filepath, "rb"), so why do we need a name attribute for file_bytes?
  4. The naming of managed_file_context isn't directly clear to me, open() would, or even implement PDFHandler as contextmanager so we can do with self but I think with self.open() would be better
  5. Is @contextmanager doing the cleanup magically or do we need to do that manually?

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.

None yet

3 participants