/[packages]/updates/1/transifex/current/SOURCES/python-magic.diff
ViewVC logotype

Contents of /updates/1/transifex/current/SOURCES/python-magic.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 214156 - (show annotations) (download)
Fri Feb 24 20:48:02 2012 UTC (12 years, 2 months ago) by misc
File size: 1070 byte(s)
update the patch, fixing #4499

1 Index: ./transifex/storage/models.py
2 ===================================================================
3 --- ./transifex/storage/models.py
4 +++ ./transifex/storage/models.py 2011-03-24 17:25:44.947065584 +0100
5 @@ -113,10 +113,18 @@
6 """
7 Try to parse the file and fill in information fields in current model
8 """
9 + # this try to guess the API of the magic module, between
10 + # the one from file and the other one from python-magic
11 + try:
12 + m = magic.Magic(mime=True)
13 + # guess mimetype and remove charset
14 + self.mime_type = m.from_file(self.get_storage_path())
15 + except (TypeError, AttributeError):
16 + m = magic.open(magic.MAGIC_NONE)
17 + m.load()
18 + self.mime_type = m.file(self.get_storage_path())
19 + m.close()
20
21 - m = magic.Magic(mime=True)
22 - # guess mimetype and remove charset
23 - self.mime_type = m.from_file(self.get_storage_path())
24 self.save()
25
26 parser = self.find_parser()

  ViewVC Help
Powered by ViewVC 1.1.30