def get_site(name, by_alias=False): if by_alias: vn = 'site/alias' else: vn = 'site/by_cname' rows = Site.view(vn, key=name) lrows = list(iter(rows)) if lrows: return lrows[0] return None
def validate_token(siteid, token): rows = Site.view('site/token', key=[token, siteid]) lrows = list(iter(rows)) if lrows: return True return False
def validate_password(siteid, password): rows = Site.view('site/password', key=[siteid, make_hash(password)]) lrows = list(iter(rows)) if lrows: return True return False