uploader_4.py 886 B

123456789101112131415161718192021222324
  1. def set_upload_targets(actions):
  2. """Translate meta targets into actual targets, set them accordingly and return."""
  3. upload_targets = get_upload_targets()
  4. slack = get_bool_key('Output', 'slack')
  5. email = get_bool_key('Output', 'mail')
  6. # A little bit long but very explicit about what should happen
  7. if actions[0] == "normal":
  8. if slack:
  9. upload_targets['slack'] = True
  10. if email:
  11. for mail in range(int(get_key('Output', 'num_mail'))):
  12. upload_targets['Mail' + str(mail)] = True
  13. elif actions[0] == "all_mail":
  14. if email:
  15. for mail in range(int(get_key('Output', 'num_mail'))):
  16. upload_targets['Mail' + str(mail)] = True
  17. else:
  18. for action in actions:
  19. if action in upload_targets:
  20. upload_targets[action] = True
  21. return upload_targets