I ran into this interesting issue. I have a method that looks like
this:
def create(self, reviewer, writer, permission, tg_errors=None):
if tg_errors:
turbogears.flash(str(tg_errors))
return self.add())
try:
data = dict(reviewer=reviewer, writer=writer,
permission=permission)
DataController.create(self, **data)
except Exception, e:
self.sql_class._connection.rollback()
turbogears.flash(e)
return self.add()
When DataController.create finishes, it issues a cherrypy.HTTPRedirect,
which my try block catches and treats like a "bad" Exception. My
personal take on this is that redirecting via Exception is a bad thing
because I can't assume an Exception is something I don't want. I know
I could work around it by checking for particular Exceptions or using a
decorator, but I still think this is a bad thing. It should just be
cherrypy.redirect. Unfortunately, turbogears.redirect raises
cherrypy.HTTPRedirect.
Randall