From 75661ae5ff312032b46cdd9a27b2384c09ebaab3 Mon Sep 17 00:00:00 2001 From: Riccardo Murri Date: Tue, 22 Nov 2016 21:03:58 +0100 Subject: [PATCH] Use `try`/`except` instead of testing for attribute existence. "It's better to ask forgiveness than permission", or so they say. --- gc3libs/cmdline.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gc3libs/cmdline.py b/gc3libs/cmdline.py index 6a8ab924..fbd2232c 100755 --- a/gc3libs/cmdline.py +++ b/gc3libs/cmdline.py @@ -1031,9 +1031,12 @@ def _fix_output_dir(self, task, name): except AttributeError: # no subtasks pass - if 'task' in task: + try: # RetryableTask self._fix_output_dir(task.task, name) + except AttributeError: + # not a RetryableTask + pass def setup_common_options(self, parser): # 1. job requirements