Adrià Vilanova MartÃnez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 1 | # Copyright 2023 The Chromium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | from google.appengine.ext import ndb |
| 6 | |
| 7 | |
| 8 | class RedirectIssue(ndb.Model): |
| 9 | """Represents a issue redirect information.""" |
| 10 | ProjectName = ndb.StringProperty() |
| 11 | MonorailLocalID = ndb.StringProperty() |
| 12 | RedirectID = ndb.StringProperty() |
| 13 | |
| 14 | @classmethod |
| 15 | def Get(cls, project, issue_local_id): |
| 16 | key = project + ':' + str(issue_local_id) |
| 17 | redirect_issue_entity = ndb.Key('RedirectIssue', key).get() |
| 18 | if not redirect_issue_entity: |
| 19 | return None |
| 20 | return redirect_issue_entity.RedirectID |