My 0.02 cents - not that anyone asked :-) I agree that "redirect()" looks cleaner, but I personally dislike magic exceptions happening at my back. It's not clear why does it break the execution flow. Using "raise" does not look as fancy but seems to me to be the "the right thing to do".
But that's just my opinion. Carlos Ribeiro On Wed, Aug 12, 2009 at 03:35, Jorge Vargas <[email protected]> wrote: > > On Wed, Aug 5, 2009 at 12:20 AM, El Tea<[email protected]> wrote: > > > > In TG1, the only redirects I ever saw were handled as exceptions. In > > TG2 I've seen two forms: > > > > redirect('/somewhere') > > > > raise tg.redirect('/somewhere') > > > > > > Is there a "right" time to do one vs. the other? Is one more correct > > than the other? One thought I've had is that the raise may be used if > > you want to indicate that any database transactions from that request > > should be discarded (I think this is done on exceptions). > > > both are ok. > > The second one was to keep compatibility with TG1, I use > redirect('foo') as it is shorter (in the back it's doing the exception > thing) > > > Thoughts? > > > > > > > > > -- Carlos Ribeiro Consultoria em Projetos blog: http://rascunhosrotos.blogspot.com blog: http://pythonnotes.blogspot.com mail: [email protected] mail: [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

