@cronjobs.register
def send_postatus_errors():
 if settings.STAGE:
  return
 def new_section(line):
  return (line.startswith('dennis ') or line.startswith('Totals') or line.startswith('BUSTED') or line.startswith('COMPILED'))
 postatus = requests.get('https://support.mozilla.org/media/postatus.txt')
 lines = postatus.content.splitlines()
 datestamp = lines.pop(0)
 errordata = []
 while lines:
  line = lines.pop(0)
  if line.startswith('>>> '):
   while (lines and (not new_section(line))):
    errordata.append(line)
    line = lines.pop(0)
 if errordata:
  mail_admins(subject=('[SUMO] postatus errors %s' % datestamp), message=((('These are the errors in the SUMO postatus file.\n' + 'See http://postatus.paas.allizom.org/p/SUMO for details\n') + 'and bug generation links.\n\n') + '\n'.join(errordata)))

@ cronjobs . register def send_postatus_errors ( ) : if settings . STAGE : return def new_section ( line ) : return ( line . startswith ( 'dennis ' ) or line . startswith ( 'Totals' ) or line . startswith ( 'BUSTED' ) or line . startswith ( 'COMPILED' ) ) postatus = requests . get ( 'https://support.mozilla.org/media/postatus.txt' ) lines = postatus . content . splitlines ( ) datestamp = lines . pop ( 0 ) errordata = [ ] while lines : line = lines . pop ( 0 ) if line . startswith ( '>>> ' ) : while ( lines and ( not new_section ( line ) ) ) : errordata . append ( line ) line = lines . pop ( 0 ) if errordata : mail_admins ( subject = ( '[SUMO] postatus errors %s' % datestamp ) , message = ( ( ( 'These are the errors in the SUMO postatus file.\n' + 'See http://postatus.paas.allizom.org/p/SUMO for details\n' ) + 'and bug generation links.\n\n' ) + '\n' . join ( errordata ) ) )
looks at postatus file and sends an email with errors .