1. Miki Tebeka
  2. pythonwise

Commits

Miki Tebeka  committed e6b68b1

new style formatting

  • Participants
  • Parent commits 033be08
  • Branches default

Comments (0)

Files changed (1)

File crashlog.py

View file
  • Ignore whitespace
 
 def send_email(emails, program, message):
     message = MIMEText(message)
-    message['Subject'] = '%s crashed' % program
+    message['Subject'] = '{} crashed'.format(program)
     crashlog_email = 'noreply@somewhere.com'
-    message['From'] = 'Crashlog <%s>' % crashlog_email
+    message['From'] = 'Crashlog <{}>'.format(crashlog_email)
 
     smtp = SMTP('mailhost.somewhere.com')
     smtp.sendmail(crashlog_email, _EMAILS, message.as_string())
 
 def format_message(type, value, traceback):
     message = StringIO()
-    out = lambda m: message.write(u'%s\n' % m)
+    out = lambda m: message.write(u'{}\n'.format(m))
 
     out(ctime())
     out('== Traceback ==')
     out(' '.join(sys.argv))
     out('\n== Environment ==')
     for key, value in environ.items():
-        out('%s = %s' % (key, value))
+        out('{} = {}'.format(key, value))
 
     return message.getvalue()
 
 
         if _LOGFILE:
             with open(_LOGFILE, 'at') as fo:
-                print >> fo, message
+                fo.write('{}\n'.format(message))
 
     finally:
         if _PREV_EXCEPTHOOK: