changeset 8:8367463fe94d

Post-validate some settings.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 04 Jul 2016 12:54:53 +0300
parents f2ecfb3e04ee
children 01c933dba120
files multimerge.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/multimerge.py	Mon Jul 04 12:54:22 2016 +0300
+++ b/multimerge.py	Mon Jul 04 12:54:53 2016 +0300
@@ -258,6 +258,16 @@
     # Parse the settings and validate
     cfg.mread(cfgparser, section)
 
+
+## Validate settings
+if not cfg.dest_name and not cfg.dest_id:
+    gcm_fatal("Target calendar ID or name required, but not set.")
+
+
+if cfg.dest_name:
+    cfg.mset("dest_name", cfg.mget("dest_name").strip())
+
+
 ## Initialize and authorize API connection
 credentials = gcm_get_credentials(cfg)
 http = credentials.authorize(httplib2.Http())