def get(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) else: if validAdmin(user): creds = get_githubcredentials() self.response.write(""" <form action='%s' method="POST"> Github Repository Owner: <input name="github_owner" type="text" value="%s" /><br> Github Repository Name: <input name="github_repo" type="text" value="%s" /><br> Github Access Token (always hidden): <input name="github_token" type="text" placeholder="access token" /><br> <input type="submit" /> </form> """%(self.request.uri, creds.owner, creds.repo)) hasAccess = False ghcreds = get_githubcredentials() gh = GitHub(creds.owner, creds.repo, creds.token) try: hasAccess = gh.hasPushAccess() except: pass if hasAccess: self.response.write("<p>Push Access Granted by GitHub.com</p>") else: self.response.write("<p>WARNING: No push access with the stored token and repo information. Please provide valid information</p>") else: self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' self.response.write("No write access for user %s"%user.email())