Esempio n. 1
0
class YOracleWebAuth:
    """YOracleWebAuth

    Webpy handler for authenticating.
    """
    def __init__(self):
        self.db = web.database(dbn='sqlite',
                               db='yoracle.sqlite')
        self.yoracle = YOracle(self.db)
        
    def GET(self):
        """YOracleWebAuth.GET()

        Handler for /auth/0/?token=%s
        """
        token = web.input()['token']
        try:
            self.yoracle.verify(token)
            return "OK"
        except YOracle.ErrNOTICE, e:
            if e.err is None:
                web.ctx.status = '409 Conflict'
            print "Notice:",e
            return "NOTICE %s" % (e.args)
        except YOracle.ErrBase, e:
            web.ctx.status = '401 Unauthorized'
            return "FAIL"
Esempio n. 2
0
class YOracleWebAuth:
    """YOracleWebAuth

    Webpy handler for authenticating.
    """
    def __init__(self):
        self.db = web.database(dbn='sqlite', db='yoracle.sqlite')
        self.yoracle = YOracle(self.db)

    def GET(self):
        """YOracleWebAuth.GET()

        Handler for /auth/0/?token=%s
        """
        token = web.input()['token']
        try:
            self.yoracle.verify(token)
            return "OK"
        except YOracle.ErrNOTICE, e:
            if e.err is None:
                web.ctx.status = '409 Conflict'
            print "Notice:", e
            return "NOTICE %s" % (e.args)
        except YOracle.ErrBase, e:
            web.ctx.status = '401 Unauthorized'
            return "FAIL"
Esempio n. 3
0
 def __init__(self):
     self.db = web.database(dbn='sqlite',
                            db='yoracle.sqlite')
     self.yoracle = YOracle(self.db)
Esempio n. 4
0
 def __init__(self):
     self.db = web.database(dbn='sqlite', db='yoracle.sqlite')
     self.yoracle = YOracle(self.db)