def lookup_token(self, token_type, token): if token_type == 'request': token_type = Token.REQUEST elif token_type == 'access': token_type = Token.ACCESS logger.debug("!!! In GAEOAuthDataStore.lookup_token key_:%s, token_type: %s"%(token,token_type)) request_tokens = Token.all()\ .filter('key_ =',token)\ .filter('token_type =',token_type).fetch(1000) if len(request_tokens) == 1: self.request_token = request_tokens[0] return self.request_token elif len(request_tokens) == 0: return None else: raise Exception('More then one %s token matches token "%s"'%(token_type,token))
def lookup_token(self, token_type, token): if token_type == 'request': token_type = Token.REQUEST elif token_type == 'access': token_type = Token.ACCESS request_tokens = (Token.all().filter('key_ =', token).filter( 'token_type =', token_type).fetch(1000)) if len(request_tokens) == 1: self.request_token = request_tokens[0] return self.request_token elif len(request_tokens) == 0: logging.info("No token found") return None else: logging.info("%d tokens found" % len(request_tokens)) raise Exception('More then one %s token matches token "%s"' % (token_type, token))
def lookup_token(self, token_type, token): if token_type == 'request': token_type = Token.REQUEST elif token_type == 'access': token_type = Token.ACCESS request_tokens = (Token.all(). filter('key_ =', token). filter('token_type =', token_type). fetch(1000)) if len(request_tokens) == 1: self.request_token = request_tokens[0] return self.request_token elif len(request_tokens) == 0: logging.info("No token found") return None else: logging.info("%d tokens found" % len(request_tokens)) raise Exception('More then one %s token matches token "%s"'%(token_type,token))