In a Pyramid web app that use SQLAlchemy I need to work also with a Tryton 
DB. With Tryton 3.8 I had implemented a Zope Data Manager for Tryton 
backend that I joined to the current transaction of my Pyramid app. Now 
with Tryton 4.0 it no longer works due to the new design of Tryton 
transaction. Here is my initial Zope Data Manager for Tryton backend :

from trytond.transaction import Transaction as TrytonTransaction

class TrytonDataManager(object):
    transaction_manager = transaction.manager

    def __init__(self, db, user, context={}):
        TrytonTransaction().start(db, user, context=context)

    def abort(self, transaction):
        pass

    def tpc_begin(self, transaction):
        pass

    def commit(self, transaction):
        pass

    def tpc_vote(self, transaction):
        pass

    def tpc_abort(self, transaction):
        pass

    def tpc_finish(self, transaction):
        cursor = TrytonTransaction().cursor
        cursor.commit()

And I have this "cleanup" hook for the Pyramid requests :

def _cleanup(request):
    TrytonTransaction().stop()
request.add_finished_callback(_cleanup)

I don't know how update my code to manage the new design of the Tryton 
transaction. Especially how to stop transaction in the cleanup hook.

Any idea ?

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/aa4902b0-78c3-49b3-ab29-e7ac22462851%40googlegroups.com.

Reply via email to