From e45324c6190639b752d61c81aec0841ace5d7b26 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Wed, 12 Apr 2023 05:30:06 -0400 Subject: [PATCH] Updated issue templates to include latest version release. Added `VERSION` file to repository root for easy tracking of current app version. Corrected bug with the latest changes to the settings model that can lead to a JSON decoding error for installations without a properly stored value. --- .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + VERSION | 1 + powerdnsadmin/models/setting.py | 10 +++++++--- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 VERSION diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 0c5a2d7..ea05799 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -15,6 +15,7 @@ body: label: PDA version description: What version of PDA are you currently running? options: + - "0.4.1" - "0.4.0" - "0.3.0" - "0.2.5" diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index e649c61..45950a1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -15,6 +15,7 @@ body: label: PDA version description: What version of PDA are you currently running? options: + - "0.4.1" - "0.4.0" - "0.3.0" - "0.2.5" diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..44bb5d1 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.4.1 \ No newline at end of file diff --git a/powerdnsadmin/models/setting.py b/powerdnsadmin/models/setting.py index 06e17d2..1932a9c 100644 --- a/powerdnsadmin/models/setting.py +++ b/powerdnsadmin/models/setting.py @@ -459,12 +459,13 @@ class Setting(db.Model): def convert_type(self, name, value): import json + from json import JSONDecodeError if name in self.types: var_type = self.types[name] # Handle boolean values if var_type == bool: - if value == 'True' or value == 'true' or value == '1' or value == True: + if value == 'True' or value == 'true' or value == '1' or value is True: return True else: return False @@ -477,8 +478,11 @@ class Setting(db.Model): if var_type == int: return int(value) - if var_type == dict or var_type == list: - return json.loads(value) + if (var_type == dict or var_type == list) and isinstance(value, str) and len(value) > 0: + try: + return json.loads(value) + except JSONDecodeError as e: + pass if var_type == str: return str(value)