def send_redirect(self, url): """ Send an HTTP redirect response to (target `url`) """ if "\n" in url or "\r" in url: raise httpexceptions.HTTPInternalServerError("Invalid redirect URL encountered.") raise httpexceptions.HTTPFound(url.encode('utf-8'), headers=self.wsgi_headeritems())
def execute(self, tool, trans, **kwds): assert self.expected_trans == trans self.execution_call_args.append(kwds) num_calls = len(self.execution_call_args) if self.expect_redirect: raise httpexceptions.HTTPFound("http://google.com") if self.exception_after_exection is not None: if num_calls > self.exception_after_exection: raise Exception("Test Exception") if self.error_message_after_excution is not None: if num_calls > self.error_message_after_excution: return None, "Test Error Message" return galaxy.model.Job(), odict(dict(out1="1"))
def kill(self, environ, start_response): if not self.allow_kill: exc = httpexceptions.HTTPForbidden( 'Killing threads has not been enabled. Shame on you ' 'for trying!') return exc(environ, start_response) vars = parse_formvars(environ) thread_id = int(vars['thread_id']) thread_pool = environ['paste.httpserver.thread_pool'] if thread_id not in thread_pool.worker_tracker: exc = httpexceptions.PreconditionFailed( 'You tried to kill thread %s, but it is not working on ' 'any requests' % thread_id) return exc(environ, start_response) thread_pool.kill_worker(thread_id) script_name = environ['SCRIPT_NAME'] or '/' exc = httpexceptions.HTTPFound( headers=[('Location', script_name+'?kill=%s' % thread_id)]) return exc(environ, start_response)
def send_redirect( self, url ): """ Send an HTTP redirect response to (target `url`) """ raise httpexceptions.HTTPFound( url, headers=self.wsgi_headeritems() )
def redirect_to(url): log.debug("Raising redirect to %s", url) raise httpexceptions.HTTPFound(url)
def send_redirect(self, url): """ Send an HTTP redirect response to (target `url`) """ raise httpexceptions.HTTPFound(url)