|
List Info
Thread: CP2.2 beta redirect
|
|
| CP2.2 beta redirect |

|
2006-02-06 22:56:27 |
|
Hello, In CP2.1 I used to do: import cherrypy from cherrypy.lib import httptools ***more here httptools.redirect('../news') ***more here
and it worked! But with CP2.2 beta: import cherrypy #from
cherrypy.lib import httptools ***more here cherrypy.HTTPRedirect('../news') ***more here does not work, it returns to the same page (no tracebacks in Eclipse/Pydev) Could somebody please explain me why? I have searched for an answer and tried several things, to no avail...
thanks, Dimitri
-- ---- "All truth passes through three stages. First, it is ridiculed. Second, it is violently opposed. Third, it is accepted as being self-evident." ~Arthur Schopenhauer ----
Please visit dimitri's website: www.serpia.org
|
| CP2.2 beta redirect |

|
2006-02-07 00:31:09 |
dimitri pater wrote:
> Hello,
> In CP2.1 I used to do:
> import cherrypy
> from cherrypy.lib import httptools
> ***more here
> httptools.redirect('../news')
> ***more here
>
> and it worked! But with CP2.2 beta:
> import cherrypy
> #from cherrypy.lib import httptools
> ***more here
> cherrypy.HTTPRedirect('../news')
> ***more here
> does not work, it returns to the same page
> (no tracebacks in Eclipse/Pydev)
> Could somebody please explain me why? I have searched
for an answer and
> tried several things, to no avail...
Hi Dmitri,
Starting with 2.1, httptools.redirect() was deprecated in
favor of the
*exception* cherrypy.HTTPRedirect. The correct way to do
redirects in
2.1 and 2.2 is:
raise cherrypy.HTTPRedirect('/somewhere/else')
Christian
|
|
| CP2.2 beta redirect |

|
2006-02-07 15:47:42 |
> httptools.redirect() was deprecated in favor of the
*exception*
which, incidentally, is not a particulary good decision ...
The following workaround was suggested, write a helper
function and
return that:
def redirect(url):
cherrypy.HTTPRedirect(url).set_response()
return cherrypy.response.body
|
|
| CP2.2 beta redirect |

|
2006-02-07 19:28:42 |
|
thank you, it works on the webserver but not on localhost though, it gets redirected to http://localhost/somepage in stead of http://localhost:8080/somepage
but I guess that is easy to solve... Thanks, Dimitri
On 2/7/06, Istvan Albert < istvan.albert gmail.com">istvan.albert gmail.com
> wrote: > httptools.redirect() was deprecated in favor of the *exception*
which, incidentally, is not a particulary good decision ...
The following workaround was suggested, write a helper function and return that:
def redirect(url): cherrypy.HTTPRedirect(url).set_response()
return cherrypy.response.body
-- ---- "All truth passes through three stages. First, it is ridiculed. Second, it is violently opposed. Third, it is accepted as being self-evident."
~Arthur Schopenhauer ---- Please visit dimitri's website: www.serpia.org
|
[1-4]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|