def post(self):
    """POST handler."""
    if not self.IsAdminUser():
      return

    mode = self.request.get('mode')
    enabled = self.request.get('enabled')
    verify = self.request.get('verify')

    if not verify:
      self.Render(
          'panic_set_verify.html',
          {'mode': {'name': mode, 'enabled': enabled}, 'report_type': 'panic'})
    else:
      if enabled == 'disable':
        enabled = False
      elif enabled == 'enable':
        enabled = True
      else:
        enabled = None

      if enabled is None:
        self.error(400)
      else:
        try:
          common.SetPanicMode(mode, enabled)
          if mail:
            user = users.get_current_user()
            subject = 'Panic Mode Update by %s' % user
            body = '%s has set \'%s\' for Panic Mode.\n' % (user, enabled)
            mail.SendMail(settings.EMAIL_ADMIN_LIST, subject, body)

          self.redirect('/admin/panic')
        except ValueError:
          self.error(400)
dataset/ETHPy150Open google/simian/src/simian/mac/admin/panic.py/AdminPanic.post/original