Sends event notifications to the L{Debug} object and the L{EventHandler} object provided by the user. The L{Debug} object will forward the notifications to it's contained snapshot objects (L{System}, L{Process}, L{Thread} and L{Module}) when appropriate.
(self, event)
| 1798 | return method |
| 1799 | |
| 1800 | def dispatch(self, event): |
| 1801 | """ |
| 1802 | Sends event notifications to the L{Debug} object and |
| 1803 | the L{EventHandler} object provided by the user. |
| 1804 | |
| 1805 | The L{Debug} object will forward the notifications to it's contained |
| 1806 | snapshot objects (L{System}, L{Process}, L{Thread} and L{Module}) when |
| 1807 | appropriate. |
| 1808 | |
| 1809 | @warning: This method is called automatically from L{Debug.dispatch}. |
| 1810 | |
| 1811 | @see: L{Debug.cont}, L{Debug.loop}, L{Debug.wait} |
| 1812 | |
| 1813 | @type event: L{Event} |
| 1814 | @param event: Event object passed to L{Debug.dispatch}. |
| 1815 | |
| 1816 | @raise WindowsError: Raises an exception on error. |
| 1817 | """ |
| 1818 | returnValue = None |
| 1819 | bCallHandler = True |
| 1820 | pre_handler = None |
| 1821 | post_handler = None |
| 1822 | eventCode = event.get_event_code() |
| 1823 | |
| 1824 | # Get the pre and post notification methods for exceptions. |
| 1825 | # If not found, the following steps take care of that. |
| 1826 | if eventCode == win32.EXCEPTION_DEBUG_EVENT: |
| 1827 | exceptionCode = event.get_exception_code() |
| 1828 | pre_name = self.__preExceptionNotifyCallbackName.get(exceptionCode, None) |
| 1829 | post_name = self.__postExceptionNotifyCallbackName.get(exceptionCode, None) |
| 1830 | if pre_name is not None: |
| 1831 | pre_handler = getattr(self, pre_name, None) |
| 1832 | if post_name is not None: |
| 1833 | post_handler = getattr(self, post_name, None) |
| 1834 | |
| 1835 | # Get the pre notification method for all other events. |
| 1836 | # This includes the exception event if no notify method was found |
| 1837 | # for this exception code. |
| 1838 | if pre_handler is None: |
| 1839 | pre_name = self.__preEventNotifyCallbackName.get(eventCode, None) |
| 1840 | if pre_name is not None: |
| 1841 | pre_handler = getattr(self, pre_name, pre_handler) |
| 1842 | |
| 1843 | # Get the post notification method for all other events. |
| 1844 | # This includes the exception event if no notify method was found |
| 1845 | # for this exception code. |
| 1846 | if post_handler is None: |
| 1847 | post_name = self.__postEventNotifyCallbackName.get(eventCode, None) |
| 1848 | if post_name is not None: |
| 1849 | post_handler = getattr(self, post_name, post_handler) |
| 1850 | |
| 1851 | # Call the pre-notify method only if it was defined. |
| 1852 | # If an exception is raised don't call the other methods. |
| 1853 | if pre_handler is not None: |
| 1854 | bCallHandler = pre_handler(event) |
| 1855 | |
| 1856 | # Call the user-defined event handler only if the pre-notify |
| 1857 | # method was not defined, or was and it returned True. |
nothing calls this directly
no test coverage detected