Change file check from isinstance(value, file) to hasattr(value, 'read') so that…
Change file check from isinstance(value, file) to hasattr(value, 'read') so that file-like objects are handled.
- if isinstance(value, file):
- file_object = value
- files.append((name, file_object.name, file_object.read()))
+ if hasattr(value, 'read'):
+ files.append((name, value.name, value.read()))
Showing
Please
register
or
sign in
to comment