示例#1
0
文件: base.py 项目: johnlunney/porick
 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()
示例#2
0
文件: base.py 项目: johnlunney/porick
 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()
示例#3
0
文件: base.py 项目: netsoc/porick
    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()
示例#4
0
文件: base.py 项目: johnlunney/porick
    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
示例#5
0
文件: __init__.py 项目: netsoc/porick
def init_model(engine):
    """Call me before using any of the tables or classes in the model"""
    db.configure(bind=engine)
示例#6
0
def init_model(engine):
    """Call me before using any of the tables or classes in the model"""
    db.configure(bind=engine)