OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import urllib |
| 6 import webapp2 |
| 7 |
| 8 from google.appengine.api import users |
| 9 from google.appengine.api.app_identity import get_application_id |
| 10 |
| 11 |
| 12 APP_NAME = get_application_id() |
| 13 |
| 14 |
| 15 class EasyTemplateRedirect(webapp2.RequestHandler): |
| 16 |
| 17 def get(self): |
| 18 user = users.get_current_user() |
| 19 if not user: |
| 20 # This shouldn't be possible, as app.yaml has "login: required" set, |
| 21 # but catch it just in case. |
| 22 self.redirect(users.create_login_url(self.request.url)) |
| 23 else: |
| 24 if user.email().endswith('@chromium.org'): |
| 25 self.redirect('http://chromiumbugs.appspot.com') |
| 26 else: |
| 27 self.redirect('http://code.google.com/p/chromium/issues') |
| 28 |
| 29 |
| 30 class DeveloperTemplateRedirect(webapp2.RequestHandler): |
| 31 |
| 32 def get(self): |
| 33 self.redirect('http://code.google.com/p/chromium/issues/entry') |
| 34 |
| 35 |
| 36 application = webapp2.WSGIApplication( |
| 37 [('/', EasyTemplateRedirect), |
| 38 ('/detailed', DeveloperTemplateRedirect), |
| 39 ]) |
OLD | NEW |