saschagottfried / todopyramid

My refactored version of ToDo Pyramid
1 stars 0 forks source link

remove code using transaction.manager and direct access to DBSession #29

Closed saschagottfried closed 10 years ago

saschagottfried commented 10 years ago

we added the session to the request and there is no current known use-case that requires to handle transaction with view code. Thus we rely on an automatic commit at the end of a request. This is what we configured with:

DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))

def get_db_session(request):
    """return thread-local DB session"""
    return DBSession

config.add_request_method(get_db_session, 'db', reify=True)