| # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import urllib |
| import webapp2 |
| |
| from google.appengine.api import users |
| from google.appengine.api.app_identity import get_application_id |
| |
| |
| APP_NAME = get_application_id() |
| |
| |
| class EasyTemplateRedirect(webapp2.RequestHandler): |
| |
| def get(self): |
| user = users.get_current_user() |
| if not user: |
| # This shouldn't be possible, as app.yaml has "login: required" set, |
| # but catch it just in case. |
| self.redirect(users.create_login_url(self.request.url)) |
| else: |
| if user.email().endswith('@chromium.org'): |
| self.redirect('http://chromiumbugs.appspot.com') |
| else: |
| self.redirect('http://code.google.com/p/chromium/issues') |
| |
| |
| class DeveloperTemplateRedirect(webapp2.RequestHandler): |
| |
| def get(self): |
| self.redirect('http://code.google.com/p/chromium/issues/entry') |
| |
| |
| application = webapp2.WSGIApplication( |
| [('/', EasyTemplateRedirect), |
| ('/detailed', DeveloperTemplateRedirect), |
| ]) |