On Sep 26, 2006, at 4:57 PM, aspineux wrote:

> So why no just return the object (replace the raise by a return)
>
> def redirect(redirect_path, redirect_params=None, **kw):
>     """Redirect (via cherrypy.HTTPRedirect)."""
>     return cherrypy.HTTPRedirect(
>                     url(tgpath=redirect_path,  
> tgparams=redirect_params,
> **kw))
>
> That way the correct usage is now :
>
> raise turbogear.redirect(url)
>
> as like used in tutorial and quickstart generated code.

This was a "bikeshed" moment from a few months ago. The code should  
probably have a comment.

Some people thought that raise felt wrong and wanted to just call a  
function. Many others, myself included, liked raise because it was  
clearest that control flow is leaving your method immediately. Having  
the raise in the redirect function didn't hurt the preferred use  
"raise turbogears.redirect(...)" and still allowed the people who  
didn't like the raise to do what they wished "turbogears.redirect(...)".

Kevin

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

Reply via email to