On Wed, Aug 12, 2009 at 6:53 PM, Carlos Ribeiro<[email protected]> wrote:
> 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".
>
That's a valid point. But who says redirect is an exception in the
first place? I mean it is implemented as an exception but it really is
a method call to another controller. So yea it's a matter of tastes.
On that same camp using redirect() opens the possibility for a future
implementation that is not an Exception :)

> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to