[Treepkg-commits] r527 - trunk/bin

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 2 12:25:59 CEST 2011


Author: bricks
Date: 2011-09-02 12:25:59 +0200 (Fri, 02 Sep 2011)
New Revision: 527

Modified:
   trunk/bin/sendnotificationmails.py
Log:
Check if config file exists and set destination of --config option to config_file


Modified: trunk/bin/sendnotificationmails.py
===================================================================
--- trunk/bin/sendnotificationmails.py	2011-09-02 10:18:54 UTC (rev 526)
+++ trunk/bin/sendnotificationmails.py	2011-09-02 10:25:59 UTC (rev 527)
@@ -9,6 +9,8 @@
 """Send pending notification mails"""
 
 import os
+import os.path
+import sys
 import smtplib
 import email
 import email.Utils
@@ -36,7 +38,7 @@
                                                  "notification.cfg"))
     parser.add_option("--config", "--config-file",
                       help=("The configuration file."
-                            " Default notification.cfg"))
+                            " Default notification.cfg"), dest="config_file")
     return parser.parse_args()
 
 
@@ -73,6 +75,9 @@
 
 def main():
     options, args = parse_commandline()
+    if not os.path.exists(options.config_file):
+        print sys.stderr >> , "File not found: %s" % options.config_file
+        sys.exit(1)
     send_notification_mails(options.config_file)
 
 main()



More information about the Treepkg-commits mailing list