Hi,

For capturing all the exceptions, I am trying to write a decorator
like this:

def custom_decorator(f):
    def wrapper(*x, **params):
        try:
            DBSession.begin()
            retval = f(*x, **params)
            DBSession.commit()
            return retval
        except Exception, e:
            DBSession.rollback()
            return {'errors' : 'Exception: ' + str(e)}
    return wrapper

Also, I have set base_config.use_transaction_manager = False in
app_cfg.py.

But, it fails with exception 'Transaction already begun'. Needing help
on how to handle it.

thanks,
Sanjay

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