Simon Volpert remailer / 0f5d021
Move panic() up to allow using it earlier during config parsing Simon Volpert 8 years ago
1 changed file(s) with 10 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
4444
4545 # Those are local scripts put in the same directory
4646 import clearmime
47
48 # Abort the execution leaving sending the list owner a backtrace
49 def panic(error):
50 logging.error('Panicking: %s' % error)
51 debug_file = '%s.eml' % time.time()
52 df = open(debug_file, 'w')
53 df.write(raw_email)
54 df.close()
55 logging.error('Offending message saved to "%s"' % debug_file)
56 sys.exit()
4757
4858 # Configuration file parsing and validation
4959 # The simplicity of this implementation does not warrant employing a ConfigParser
6171 for s in ['backend', 'server', 'login', 'passwd', 'allowed_senders', 'list_owner', 'gnupg_file']:
6272 if s not in conf:
6373 panic('`%s` key is missing from configuration file' % s)
64
65 # Abort the execution leaving sending the list owner a backtrace
66 def panic(error):
67 logging.error('Panicking: %s' % error)
68 debug_file = '%s.eml' % time.time()
69 df = open(debug_file, 'w')
70 df.write(raw_email)
71 df.close()
72 logging.error('Offending message saved to "%s"' % debug_file)
73 sys.exit()
7474
7575 # Send one or more pre-constructed emails
7676 def sendmail(message_list):