From 02eda83a84a80f4ad5f5e3fe147262551d38b90b Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 2 Jan 2020 22:40:35 +0100 Subject: [PATCH] utils/export_as_csv: Catch more-specific TypeError instead of broad Exception (W0703) Fixes the broad-except (W0703) pylint error. Signed-off-by: Fabian P. Schmidt --- .pylintrc | 1 - .pylintrc3 | 1 - network/base/utils.py | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 3e9fc41..146f8bb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -10,4 +10,3 @@ disable= R0912, # too-many-branches R0913, # too-many-arguments R0914, # too-many-locals - W0703, # broad-except diff --git a/.pylintrc3 b/.pylintrc3 index 81bd2a8..93ecd62 100644 --- a/.pylintrc3 +++ b/.pylintrc3 @@ -12,4 +12,3 @@ disable= R0912, # too-many-branches R0913, # too-many-arguments R0914, # too-many-locals - W0703, # broad-except diff --git a/network/base/utils.py b/network/base/utils.py index 64fe9ad..16702a4 100644 --- a/network/base/utils.py +++ b/network/base/utils.py @@ -48,7 +48,7 @@ def export_as_csv(modeladmin, request, queryset): try: # get value from model value = value() - except Exception: + except TypeError: # get value from modeladmin e.g: admin_method_1 value = value(row) if value is None: