mirror of
https://github.com/caronc/apprise.git
synced 2025-08-18 12:30:13 +02:00
Copywrite update & support boolean based asset values in YAML config (#301)
This commit is contained in:
@@ -675,7 +675,9 @@ class ConfigBase(URLBase):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if not (hasattr(asset, k) and
|
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
|
# We can't set a function or non-string set value
|
||||||
ConfigBase.logger.warning(
|
ConfigBase.logger.warning(
|
||||||
'Invalid asset key "{}".'.format(k))
|
'Invalid asset key "{}".'.format(k))
|
||||||
@@ -685,15 +687,23 @@ class ConfigBase(URLBase):
|
|||||||
# Convert to an empty string
|
# Convert to an empty string
|
||||||
v = ''
|
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
|
# we must set strings with a string
|
||||||
ConfigBase.logger.warning(
|
ConfigBase.logger.warning(
|
||||||
'Invalid asset value to "{}".'.format(k))
|
'Invalid asset value to "{}".'.format(k))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Set our asset object with the new value
|
|
||||||
setattr(asset, k, v.strip())
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# global tag root directive
|
# global tag root directive
|
||||||
#
|
#
|
||||||
|
@@ -703,6 +703,7 @@ asset:
|
|||||||
app_id: AppriseTest
|
app_id: AppriseTest
|
||||||
app_desc: Apprise Test Notifications
|
app_desc: Apprise Test Notifications
|
||||||
app_url: http://nuxref.com
|
app_url: http://nuxref.com
|
||||||
|
async_mode: no
|
||||||
|
|
||||||
# Support setting empty values
|
# Support setting empty values
|
||||||
image_url_mask:
|
image_url_mask:
|
||||||
@@ -738,6 +739,9 @@ urls:
|
|||||||
assert asset.app_desc == "Apprise Test Notifications"
|
assert asset.app_desc == "Apprise Test Notifications"
|
||||||
assert asset.app_url == "http://nuxref.com"
|
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
|
# the theme was not updated and remains the same as it was
|
||||||
assert asset.theme == AppriseAsset().theme
|
assert asset.theme == AppriseAsset().theme
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This code is licensed under the MIT License.
|
# This code is licensed under the MIT License.
|
||||||
|
Reference in New Issue
Block a user