def safe_update_last_login(sender, user, **kwargs):
 try:
  update_last_login(sender, user, **kwargs)
 except DatabaseError as exc:
  logging.warn(six.text_type(exc), exc_info=True)

def safe_update_last_login ( sender , user , ** kwargs ) : try : update_last_login ( sender , user , ** kwargs ) except DatabaseError as exc : logging . warn ( six . text_type ( exc ) , exc_info = True )
identical to djangos built-in handler except that we gracefully handle database failures .