Ejemplo n.º 1
0
    def _get_handlers(self):
        """ Returns the handler stack associated with the currently executing
            thread.
        """
        thread_local = self.thread_local
        if isinstance(thread_local, dict):
            id = threading.current_thread().ident
            handlers = thread_local.get(id)
        else:
            handlers = getattr(thread_local, "handlers", None)

        if handlers is None:
            if self.main_thread is not None:
                handler = self.main_thread[-1]
            else:
                handler = NotificationExceptionHandlerState(
                    self._log_exception, False, False
                )
            handlers = [handler]
            if isinstance(thread_local, dict):
                thread_local[id] = handlers
            else:
                thread_local.handlers = handlers

        return handlers
Ejemplo n.º 2
0
    def _get_handlers ( self ):
        """ Returns the handler stack associated with the currently executing
            thread.
        """
        thread_local = self.thread_local
        if isinstance( thread_local, dict ):
            id       = get_ident()
            handlers = thread_local.get( id )
        else:
            handlers = getattr( thread_local, 'handlers', None )

        if handlers is None:
            if self.main_thread is not None:
                handler = self.main_thread[-1]
            else:
                handler = NotificationExceptionHandlerState(
                              self._log_exception, False, False )
            handlers = [ handler ]
            if isinstance( thread_local, dict ):
                thread_local[ id ] = handlers
            else:
                thread_local.handlers = handlers

        return handlers