def determine_test_run_method(self, data): """ Determine the method to use. @param data: the request data. :return: a data dictionary containing 'successful' - whether the function executed successfully or not. 'method' - the method to use. """ operation = self.inspect.stack()[0][3] result = {'successful': False, 'method': None} try: self.log.trace("%s ..." % operation.replace('_', ' ')) if data is None: raise AssertionError("No data received.") else: # determine by button pressed for entry in METHODS.keys(): if METHODS[entry]['widget'] in data: result['method'] = METHODS[entry] self.log.trace("Received '%s' command." % result['method']['name']) break self.log.trace("... done %s." % operation.replace('_', ' ')) result['successful'] = True except BaseException, e: self.handle_exception(e, operation=operation)