Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for http://pypi.python.org/pypi/filemagic version of pyth…

…on-magic
  • Loading branch information...
commit 990b48c6c010c276d32a20c004a4892caf9fb2a9 1 parent a7d2756
@ksperling ksperling authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 S3/S3.py
View
9 S3/S3.py
@@ -37,7 +37,14 @@ def mime_magic_file(file):
return magic_.from_file(file)
def mime_magic_buffer(buffer):
return magic_.from_buffer(buffer)
- except (TypeError, AttributeError):
+ except TypeError:
+ ## http://pypi.python.org/pypi/filemagic
+ magic_ = magic.Magic(flags=magic.MAGIC_MIME)
+ def mime_magic_file(file):
+ return magic_.id_filename(file)
+ def mime_magic_buffer(buffer):
+ return magic_.id_buffer(buffer)
+ except AttributeError:
## Older python-magic versions
magic_ = magic.open(magic.MAGIC_MIME)
magic_.load()
Please sign in to comment.
Something went wrong with that request. Please try again.