Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: appengine/monorail/framework/artifactcollision.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/framework/alerts.py ('k') | appengine/monorail/framework/banned.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/framework/artifactcollision.py
diff --git a/appengine/monorail/framework/artifactcollision.py b/appengine/monorail/framework/artifactcollision.py
new file mode 100644
index 0000000000000000000000000000000000000000..2cd06517c16ec7f02736382dddf591691574af00
--- /dev/null
+++ b/appengine/monorail/framework/artifactcollision.py
@@ -0,0 +1,49 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Class that implements the artifact update collision page.
+
+This page is displayed only when one user views and edits an issue,
+but another user has already submitted an issue update before the
+first user submits his/her update.
+
+TODO(jrobbins): give the user better options on how to proceed.
+
+Summary of classes:
+ ArtifactCollision: Show an error message explaining the mid-air collision.
+"""
+
+import re
+
+from framework import monorailrequest
+from framework import servlet
+
+
+class ArtifactCollision(servlet.Servlet):
+ """ArtifactCollision page explains that a mid-air collision has occured."""
+
+ _PAGE_TEMPLATE = 'framework/artifact-collision-page.ezt'
+ _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_NONE
+
+ def GatherPageData(self, mr):
+ """Build up a dictionary of data values to use when rendering the page.
+
+ Args:
+ mr: commonly used info parsed from the request.
+
+ Returns:
+ A dict of values used by EZT for rendering the page.
+ """
+ artifact_name = mr.GetParam('name')
+ if not artifact_name:
+ raise monorailrequest.InputException() # someone forged a link
+
+ artifact_detail_url = '/p/%s/issues/detail?id=%s' % (
+ mr.project_name, mr.continue_issue_id)
+
+ return {
+ 'artifact_name': artifact_name,
+ 'artifact_detail_url': artifact_detail_url,
+ }
« no previous file with comments | « appengine/monorail/framework/alerts.py ('k') | appengine/monorail/framework/banned.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698