blob: d25a7c1b4ced842a56813bf465e77d8f5b4254fa [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""Redirect to /issues/entry or an external URL (like the wizard).
7"""
8from __future__ import print_function
9from __future__ import division
10from __future__ import absolute_import
11
12import logging
13
14from framework import servlet
15from framework import servlet_helpers
16
17
18class IssueEntryAfterLogin(servlet.Servlet):
19 """Redirect after clicking "New issue" and logging in."""
20
21 # Note: This servlet does not use an HTML template.
22
23 def GatherPageData(self, mr):
24 """Build up a dictionary of data values to use when rendering the page."""
25 if not mr.auth.user_id:
26 self.abort(400, 'Only signed-in users should reach this URL.')
27
28 with mr.profiler.Phase('getting config'):
29 config = self.services.config.GetProjectConfig(mr.cnxn, mr.project_id)
30 entry_page_url = servlet_helpers.ComputeIssueEntryURL(mr, config)
31 logging.info('Redirecting to %r', entry_page_url)
32 self.redirect(entry_page_url, abort=True)