def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: return WSGIController.__call__(self, environ, start_response) finally: db.remove()
def _process_auth_cookies(self): c.logged_in = False c.user = None auth = request.cookies.get('auth') username = request.cookies.get('username') level = request.cookies.get('level') if auth: if hashlib.md5('%s:%s:%s' % (config['COOKIE_SECRET'], username, level)).hexdigest() == auth: c.logged_in = True c.user = db.query(User).filter(User.username == username).first()
def _process_auth_cookies(self): c.logged_in = False c.user = None auth = request.cookies.get('auth') username = request.cookies.get('username') level = request.cookies.get('level') if auth: if hashlib.md5('%s:%s:%s' % (config['COOKIE_SECRET'], username, level)).hexdigest() == auth: c.user = db.query(User).filter( User.username == username).first() if c.user: c.logged_in = True
def init_model(engine): """Call me before using any of the tables or classes in the model""" db.configure(bind=engine)