def redirect(self, to_url, permanent=False): if permanent: raise exc.HTTPMovedPermanently(to_url) raise exc.HTTPFound(to_url)