# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Breakpad for Python.

Sends a notification when a process stops on an exception."""

import atexit
import getpass
import urllib
import traceback
import sys


def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
  print 'Do you want to send a crash report [y/N]? ',
  if sys.stdin.read(1).lower() == 'y':
    try:
      params = {
          'args': sys.argv,
          'stack': stack,
          'user': getpass.getuser(),
      }
      request = urllib.urlopen(url, urllib.urlencode(params))
      print request.read()
      request.close()
    except IOError:
      print('There was a failure while trying to send the stack trace. Too bad.')


#@atexit.register
def CheckForException():
  if 'test' in sys.modules['__main__'].__file__:
    # Probably a unit test.
    return
  last_tb = getattr(sys, 'last_traceback', None)
  if last_tb:
    SendStack(''.join(traceback.format_tb(last_tb)))

@@ -308,16 +308,30 @@
 aceback%0A
+import socket%0A
 import s
@@ -493,17 +493,17 @@
 lower() 
-=
+!
 = 'y':%0A 
@@ -509,15 +509,57 @@
     
+return%0A  print 'Sending crash report ...'%0A  
 try:%0A
-  
     
@@ -577,18 +577,16 @@
         
-  
 'args': 
@@ -603,18 +603,16 @@
         
-  
 'stack':
@@ -619,18 +619,16 @@
  stack,%0A
-  
         
@@ -662,14 +662,10 @@
     
-  %7D%0A  
+%7D%0A
     
@@ -720,18 +720,16 @@
 arams))%0A
-  
     prin
@@ -749,18 +749,16 @@
 d()%0A    
-  
 request.
@@ -767,18 +767,16 @@
 ose()%0A  
- 
- 
 except I
@@ -783,18 +783,16 @@
 OError:%0A
-  
     prin
@@ -869,26 +869,8 @@
 )%0A%0A%0A
-#@atexit.register%0A
 def 
@@ -894,96 +894,8 @@
 ():%0A
-  if 'test' in sys.modules%5B'__main__'%5D.__file__:%0A    # Probably a unit test.%0A    return%0A
   la
@@ -1006,8 +1006,218 @@
 t_tb)))%0A
+%0A%0Aif (not 'test' in sys.modules%5B'__main__'%5D.__file__ and%0A    socket.gethostname().endswith('.google.com')):%0A  # Skip unit tests and we don't want anything from non-googler.%0A  atexit.register(CheckForException)%0A

Add a check so non-google employee don't send crash dumps.