#!/usr/bin/env python
# -*- coding: utf-8 -*-

from notmm.dbapi.backends.sql import with_session
from notmm.http.decorators import post_required
from notmm.utils.template import direct_to_template

from sandbox_sqlalchemy.config import database as db

#@post_required
@with_session(engine=db.engine)
def test_with_session(request, **kwds):
    session = request.environ['_scoped_session']
    data = {
      'user' : session.query('User').first()
      }
    print data  
    #print session.info
    return direct_to_template(request, template_name='sandbox/test.mako', 
        status=200)
    
