Skip to content

Commit 1fb0add

Browse files
authored
Notifications - Support for commented out notification URLs (#2825 #2769)
1 parent 2614b27 commit 1fb0add

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

changedetectionio/forms.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,12 @@ def __call__(self, form, field):
308308
# so that the custom endpoints are registered
309309
from changedetectionio.apprise_plugin import apprise_custom_api_call_wrapper
310310
for server_url in field.data:
311-
if not apobj.add(server_url):
312-
message = field.gettext('\'%s\' is not a valid AppRise URL.' % (server_url))
311+
url = server_url.strip()
312+
if url.startswith("#"):
313+
continue
314+
315+
if not apobj.add(url):
316+
message = field.gettext('\'%s\' is not a valid AppRise URL.' % (url))
313317
raise ValidationError(message)
314318

315319
class ValidateJinja2Template(object):

changedetectionio/notification.py

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ def process_notification(n_object, datastore):
7979
n_title = jinja_render(template_str=n_object.get('notification_title', ''), **notification_parameters)
8080

8181
url = url.strip()
82+
if url.startswith('#'):
83+
logger.trace(f"Skipping commented out notification URL - {url}")
84+
continue
85+
8286
if not url:
8387
logger.warning(f"Process Notification: skipping empty notification URL.")
8488
continue

0 commit comments

Comments
 (0)