From bd5bf1166151872f90badc587994f4b7fe5b5c4a Mon Sep 17 00:00:00 2001 From: "Maxence G. de Montauzan" Date: Sat, 4 Jul 2020 01:03:26 +0200 Subject: [PATCH] Fix: don't send mail if no news [task 2, status:done] --- README.md | 3 +++ notifier.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index b6f23b5..2d5c56a 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ I wrote this script really quickly, certainly faster than this README. So I alre * The script sends mail even if no new projets or release has been detected * The biggest, you have to edit script to specify absolute path... * A lot of other little problems, like the code that's disgusting and so on. + +For who's asking: yes, it's normal that I have put all code in one main function [like a blind gunner.](https://media.giphy.com/media/1yMexL5rkwYhuiVEmZ/giphy.gif). Really quickly I said! + But overall, the script works and sends mail! Hey boy, what is the `pit.db` file? diff --git a/notifier.py b/notifier.py index d14f158..0fe20fd 100644 --- a/notifier.py +++ b/notifier.py @@ -42,6 +42,10 @@ def main(): new_releases.append(last_release) parser.set('release', project, last_release['release_tag']) + if not new_releases and not new_projects: + print('No new projets or new release detected. Bye!') + return + content = "" for new_r in new_releases: