Skip to content
New issue

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

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

Already on GitHub? # to your account

Support Tempfiles in file_upload creation requests #611

Merged
merged 1 commit into from
Dec 6, 2017

Conversation

ob-stripe
Copy link
Contributor

@ob-stripe ob-stripe commented Dec 6, 2017

r? @brandur-stripe
cc @stripe/api-libraries @remi-stripe

Fixes #610.

Back in #508, we reintroduced support for passing File instances, but not Tempfile instances. (I'm not sure why Tempfile is not a subclass of File but ¯\_(ツ)_/¯)

This PR adds support for passing Tempfile instances, which is useful for e.g. opening a remote file via open-uri.

@brandur-stripe
Copy link
Contributor

Back in #508, we reintroduced support for passing File instances, but not Tempfile instances. (I'm not sure why Tempfile is not a subclass of File but ¯_(ツ)_/¯)

Haha, yes that does seem to really strange!

I just took a quick look at it, and it turns out that the reason is that it uses a special DelegateClass(File) as its parent. This presumably does the right thing, but has the side effect of rendering the class hierarchy nonsensical. Gotta love metaprogramming :)

@brandur-stripe brandur-stripe merged commit ee30b1f into master Dec 6, 2017
@brandur-stripe brandur-stripe deleted the ob-fix-610 branch December 6, 2017 18:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants