GET parms: title, type, format, and tag used if not in payload (#84)

This commit is contained in:
Chris Caron
2022-06-27 06:31:56 -04:00
committed by GitHub
parent d7824e24c7
commit 186c521ca6
3 changed files with 125 additions and 0 deletions

View File

@ -471,6 +471,7 @@ class NotifyView(View):
content = {}
if MIME_IS_FORM.match(request.content_type):
content = {}
form = NotifyForm(request.POST)
if form.is_valid():
content.update(form.cleaned_data)
@ -502,6 +503,34 @@ class NotifyView(View):
status=status,
)
#
# Allow 'tag' value to be specified as part of the URL parameters
# if not found otherwise defined.
#
if not content.get('tag') and 'tag' in request.GET:
content['tag'] = request.GET['tag']
#
# Allow 'format' value to be specified as part of the URL
# parameters if not found otherwise defined.
#
if not content.get('format') and 'format' in request.GET:
content['format'] = request.GET['format']
#
# Allow 'type' value to be specified as part of the URL parameters
# if not found otherwise defined.
#
if not content.get('type') and 'type' in request.GET:
content['type'] = request.GET['type']
#
# Allow 'title' value to be specified as part of the URL parameters
# if not found otherwise defined.
#
if not content.get('title') and 'title' in request.GET:
content['title'] = request.GET['title']
# Some basic error checking
if not content.get('body') or \
content.get('type', apprise.NotifyType.INFO) \