From f11ba1f694bca8626bce837c388fedb535cbe97d Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 27 Dec 2012 16:31:29 +0100 Subject: Improve mat.py (mostly exceptions handling) --- MAT/mat.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'MAT') diff --git a/MAT/mat.py b/MAT/mat.py index 84f26f2..1ec2150 100644 --- a/MAT/mat.py +++ b/MAT/mat.py @@ -92,13 +92,13 @@ def secure_remove(filename): try: subprocess.call(['shred', '--remove', filename]) removed = True - except: + except OSError: logging.error('Unable to securely remove %s' % filename) - if removed is False: + if not removed: try: os.remove(filename) - except: + except OSError: logging.error('Unable to remove %s' % filename) @@ -149,7 +149,4 @@ def create_class_file(name, backup, **kwargs): logging.info('Don\'t have stripper for %s format' % mime) return None - if mime.endswith('pdf') and mime.startswith('application/'): - return stripper_class(filename, parser, mime, backup, **kwargs) - return stripper_class(filename, parser, mime, backup, **kwargs) -- cgit v1.3