diff --git a/apprise/config/ConfigBase.py b/apprise/config/ConfigBase.py index 553cf47d..50a7baeb 100644 --- a/apprise/config/ConfigBase.py +++ b/apprise/config/ConfigBase.py @@ -675,7 +675,9 @@ class ConfigBase(URLBase): continue if not (hasattr(asset, k) and - isinstance(getattr(asset, k), six.string_types)): + isinstance(getattr(asset, k), + (bool, six.string_types))): + # We can't set a function or non-string set value ConfigBase.logger.warning( 'Invalid asset key "{}".'.format(k)) @@ -685,15 +687,23 @@ class ConfigBase(URLBase): # Convert to an empty string v = '' - if not isinstance(v, six.string_types): + if (isinstance(v, (bool, six.string_types)) + and isinstance(getattr(asset, k), bool)): + + # If the object in the Asset is a boolean, then + # we want to convert the specified string to + # match that. + setattr(asset, k, parse_bool(v)) + + elif isinstance(v, six.string_types): + # Set our asset object with the new value + setattr(asset, k, v.strip()) + + else: # we must set strings with a string ConfigBase.logger.warning( 'Invalid asset value to "{}".'.format(k)) continue - - # Set our asset object with the new value - setattr(asset, k, v.strip()) - # # global tag root directive # diff --git a/test/test_config_base.py b/test/test_config_base.py index 5dc2e3d8..b35b0ad7 100644 --- a/test/test_config_base.py +++ b/test/test_config_base.py @@ -703,6 +703,7 @@ asset: app_id: AppriseTest app_desc: Apprise Test Notifications app_url: http://nuxref.com + async_mode: no # Support setting empty values image_url_mask: @@ -738,6 +739,9 @@ urls: assert asset.app_desc == "Apprise Test Notifications" assert asset.app_url == "http://nuxref.com" + # Boolean types stay boolean + assert asset.async_mode is False + # the theme was not updated and remains the same as it was assert asset.theme == AppriseAsset().theme diff --git a/test/test_discord_plugin.py b/test/test_discord_plugin.py index ea884fc3..ffd40bbb 100644 --- a/test/test_discord_plugin.py +++ b/test/test_discord_plugin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_gitter_plugin.py b/test/test_gitter_plugin.py index 3765b23a..ee611083 100644 --- a/test/test_gitter_plugin.py +++ b/test/test_gitter_plugin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_matrix_plugin.py b/test/test_matrix_plugin.py index 8fb9de85..acc139aa 100644 --- a/test/test_matrix_plugin.py +++ b/test/test_matrix_plugin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_nextcloud_plugin.py b/test/test_nextcloud_plugin.py index d4115905..b9ae7630 100644 --- a/test/test_nextcloud_plugin.py +++ b/test/test_nextcloud_plugin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_office365.py b/test/test_office365.py index 1f7a599b..037ce2e9 100644 --- a/test/test_office365.py +++ b/test/test_office365.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_pushbullet.py b/test/test_pushbullet.py index 5004f865..10bfb606 100644 --- a/test/test_pushbullet.py +++ b/test/test_pushbullet.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_pushover.py b/test/test_pushover.py index 6924b5c0..6de2a311 100644 --- a/test/test_pushover.py +++ b/test/test_pushover.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_pushsafer.py b/test/test_pushsafer.py index 7bbe6f1a..b1ffb93d 100644 --- a/test/test_pushsafer.py +++ b/test/test_pushsafer.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_slack_plugin.py b/test/test_slack_plugin.py index 2613bff8..8ba4b4c7 100644 --- a/test/test_slack_plugin.py +++ b/test/test_slack_plugin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License. diff --git a/test/test_telegram.py b/test/test_telegram.py index c32387ce..a3dee6e1 100644 --- a/test/test_telegram.py +++ b/test/test_telegram.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +# Copyright (C) 2020 Chris Caron # All rights reserved. # # This code is licensed under the MIT License.