comparison multimerge.py @ 50:f8618bae162a

Improve debug messages and comments.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 05 Jul 2016 18:01:11 +0300
parents cc30383f5f0d
children 54644b29a9a3
comparison
equal deleted inserted replaced
49:cc30383f5f0d 50:f8618bae162a
355 break 355 break
356 356
357 if len(calendars) == 0: 357 if len(calendars) == 0:
358 gcm_fatal("No calendars found?") 358 gcm_fatal("No calendars found?")
359 359
360 gcm_debug(u"{0} calendars total found.".format(len(calendars)))
361
360 362
361 ## Filter desired SOURCE calendars based on specified regexp 363 ## Filter desired SOURCE calendars based on specified regexp
362 src_re = re.compile(cfg.source_regex, re.UNICODE) 364 src_re = re.compile(cfg.source_regex, re.UNICODE)
363 src_calendars = [] 365 src_calendars = []
364 for calendar in calendars: 366 for calendar in calendars:
365 if "summary" in calendar: 367 if "summary" in calendar:
368 # Find destination calendar ID if not set
366 if not cfg.dest_id and cfg.dest_name == calendar["summary"].strip(): 369 if not cfg.dest_id and cfg.dest_name == calendar["summary"].strip():
367 cfg.mset("dest_id", calendar["id"]) 370 cfg.mset("dest_id", calendar["id"])
368 371
369 mre = src_re.match(calendar["summary"]) 372 mre = src_re.match(calendar["summary"])
370 if mre: 373 if mre:
371 calendar["gcm_title"] = mre.group(cfg.source_regmap[0]) 374 calendar["gcm_title"] = mre.group(cfg.source_regmap[0])
372 calendar["gcm_id"] = mre.group(cfg.source_regmap[1]) 375 calendar["gcm_id"] = mre.group(cfg.source_regmap[1])
373 src_calendars.append(calendar) 376 src_calendars.append(calendar)
374 377
375 378 gcm_debug(u"{0} source calendars found.".format(len(src_calendars)))
376 ## Check if we have target ID 379
380
381 ## Check if we have destination calendar ID
377 if not cfg.dest_id: 382 if not cfg.dest_id:
378 gcm_fatal(u"Could not find target/destination calendar ID for '"+ cfg.dest_name +"'.") 383 gcm_fatal(u"Could not find target/destination calendar ID for '"+ cfg.dest_name +"'.")
379 384
380 385
381 ## Now, we fetch and collect events 386 ## Now, we fetch and collect events