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"
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"
def __init__(self): self.db = web.database(dbn='sqlite', db='yoracle.sqlite') self.yoracle = YOracle(self.db)