Can you please give the complete example in code.py or share the code.py file thanks
On Mon, Jun 9, 2008 at 10:02 AM, Anand Chitipothu <[EMAIL PROTECTED]> wrote: > > > def loadsa(): > > session = scoped_session( > > sessionmaker( > > autoflush=True, > > transactional=True, > > bind=engine > > ) > > ) > > web.ctx.sadbsession = session > > web.ctx.sadb = session() > > app.add_processor(web.loadhook(loadsa)) > > > > def unloadsa(): > > web.ctx.sadb.close() > > web.ctx.sadbsession.remove() > > app.add_processor(web.unloadhook(unloadsa)) > > You can combine them into single processor. > > def sa_processor(handler): > session = scoped_session( > sessionmaker( > autoflush=True, > transactional=True, > bind=engine > ) > ) > web.ctx.sadbsession = session > web.ctx.sadb = session() > > try: > return handler() > finally: > web.ctx.sadb.close() > web.ctx.sadbsession.remove() > > app.add_processor(sa_processor) > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
