/[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 101464 - (show annotations) (download)
Wed Jun 1 19:01:05 2011 UTC (12 years, 10 months ago) by schedbot
File size: 1057 byte(s)
SILENT: branch release 1
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 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