diff options
| author | jvoisin | 2012-12-27 16:38:19 +0100 |
|---|---|---|
| committer | jvoisin | 2012-12-27 16:38:19 +0100 |
| commit | a36f48b460f7638052f2e8ac3f9ddde8232cf339 (patch) | |
| tree | d8b5427642cd2743c189e60e7364c2cbbc0713c0 /MAT | |
| parent | f11ba1f694bca8626bce837c388fedb535cbe97d (diff) | |
Specify exceptions for torrents hadling
Diffstat (limited to 'MAT')
| -rw-r--r-- | MAT/misc.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/MAT/misc.py b/MAT/misc.py index 1ffc327..28ee892 100644 --- a/MAT/misc.py +++ b/MAT/misc.py | |||
| @@ -26,7 +26,7 @@ class TorrentStripper(parser.GenericParser): | |||
| 26 | try: | 26 | try: |
| 27 | if decoded[key] != '': | 27 | if decoded[key] != '': |
| 28 | return False | 28 | return False |
| 29 | except: | 29 | except KeyError: |
| 30 | pass | 30 | pass |
| 31 | return True | 31 | return True |
| 32 | 32 | ||
| @@ -41,7 +41,7 @@ class TorrentStripper(parser.GenericParser): | |||
| 41 | try: | 41 | try: |
| 42 | if decoded[key] != '': | 42 | if decoded[key] != '': |
| 43 | metadata[key] = decoded[key] | 43 | metadata[key] = decoded[key] |
| 44 | except: | 44 | except KeyError: |
| 45 | pass | 45 | pass |
| 46 | return metadata | 46 | return metadata |
| 47 | 47 | ||
| @@ -54,7 +54,7 @@ class TorrentStripper(parser.GenericParser): | |||
| 54 | for key in self.fields: | 54 | for key in self.fields: |
| 55 | try: | 55 | try: |
| 56 | decoded[key] = '' | 56 | decoded[key] = '' |
| 57 | except: | 57 | except KeyError: |
| 58 | pass | 58 | pass |
| 59 | with open(self.output, 'w') as f: # encode the decoded torrent | 59 | with open(self.output, 'w') as f: # encode the decoded torrent |
| 60 | f.write(bencode.bencode(decoded)) # and write it in self.output | 60 | f.write(bencode.bencode(decoded)) # and write it in self.output |
