Konstantin Veretennicov wrote:
> One thing I noticed: Rails' "redirect_to" looks nicer *and* more
> explicit than "raise cherrypy.HTTPRedirect". And it's easy to fix by
> adding "turbogears.redirect_to" wrapper.
>

Regarding this, I think raising an exception is better (hence more
explicit) than calling a function.
A redirect it's clearly a break of the normal control flow while a
function call it's supposed to give the control back to the caller.

What I find less nice it's the need to type every time
turbogears.url(...).

For example:

   raise cherrypy.HTTPRedirect(turbogears.url("/%s" % pagename))

What about a wrapper around the cherrypy exception that uses the
turbogears.url function?

Something like this seems pretty good and nice looking (at least to
me):

   raise turbogears.HTTPRedirect("/notfound", pagename= pagename)

It's still like the CherryPy one (and not a departure from the CherryPy
philosophy), but it uses the turbogears.url function (that anyway you
are supposed to always use on your TG apps) and it helps to take away
some boilerplate code.

I know we already had this discussion back in the early days, but IIRC
turbogears.url was not there.

Ciao
Michele

Reply via email to