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

Unified Diff: dashboard/dashboard/pinpoint/handlers/new.py

Issue 3002903002: [pinpoint] Refactor Quest Generator. (Closed)
Patch Set: Comments Created 3 years, 4 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
Index: dashboard/dashboard/pinpoint/handlers/new.py
diff --git a/dashboard/dashboard/pinpoint/handlers/new.py b/dashboard/dashboard/pinpoint/handlers/new.py
index ec8ff73ba4a2476b7605b3bcccc93f3e5005c87f..06da483f60e223aa5277d63354429a65b1b693f8 100644
--- a/dashboard/dashboard/pinpoint/handlers/new.py
+++ b/dashboard/dashboard/pinpoint/handlers/new.py
@@ -6,9 +6,9 @@ import json
import webapp2
from dashboard.api import api_auth
+from dashboard.pinpoint.handlers import quest_generator
from dashboard.pinpoint.models import change
from dashboard.pinpoint.models import job as job_module
-from dashboard.pinpoint.models import quest_generator as quest_generator_module
_ERROR_BUG_ID = 'Bug ID must be an integer.'
@@ -47,14 +47,14 @@ class New(webapp2.RequestHandler):
}
# Validate arguments and convert them to canonical internal representation.
- quest_generator = quest_generator_module.QuestGenerator(self.request)
- bug_id = self._ValidateBugId(bug_id)
- changes = self._ValidateChanges(change_1, change_2)
+ arguments, quests = quest_generator.GenerateQuests(self.request)
+ bug_id = _ValidateBugId(bug_id)
+ changes = _ValidateChanges(change_1, change_2)
# Create job.
job = job_module.Job.New(
- arguments=quest_generator.AsDict(),
- quests=quest_generator.Quests(),
+ arguments=arguments,
+ quests=quests,
auto_explore=auto_explore,
bug_id=bug_id)
@@ -76,14 +76,16 @@ class New(webapp2.RequestHandler):
'jobUrl': job.url
}))
- def _ValidateBugId(self, bug_id):
- if not bug_id:
- return None
- try:
- return int(bug_id)
- except ValueError:
- raise ValueError(_ERROR_BUG_ID)
+def _ValidateBugId(bug_id):
+ if not bug_id:
+ return None
+
+ try:
+ return int(bug_id)
+ except ValueError:
+ raise ValueError(_ERROR_BUG_ID)
+
- def _ValidateChanges(self, change_1, change_2):
- return (change.Change.FromDict(change_1), change.Change.FromDict(change_2))
+def _ValidateChanges(change_1, change_2):
+ return (change.Change.FromDict(change_1), change.Change.FromDict(change_2))
« no previous file with comments | « dashboard/dashboard/pinpoint/handlers/jobs_test.py ('k') | dashboard/dashboard/pinpoint/handlers/quest_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698