Like this?

    from cherrypy.lib.filter    import basefilter
    from myproject.model        import hub

    class TxnFilter(basefilter.BaseFilter):
        def onStartResource(self):
            hub.begin()

        def onEndResource(self):
            hub.end()

I should follow this up with the fact that the actual *error* handling (the rolling back of transactions on exceptions) would still have to occur in the expose decorator because, as far as I know, CherryPy doesn't have an `onException` hook in its filter support (although I think it should).

   -- Jon

Reply via email to