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

Unified Diff: appengine/isolate/handlers_frontend.py

Issue 1708283003: isolateserver: add checkbox to enable ts_mon (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: More comments addressed Created 4 years, 10 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 | « no previous file | appengine/isolate/templates/restricted_config.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/isolate/handlers_frontend.py
diff --git a/appengine/isolate/handlers_frontend.py b/appengine/isolate/handlers_frontend.py
index f93736c7497398d8b6f43ad7920c01cc3040c283..a811af35aa6f115dfe48414ab44ece4aee1b466b 100644
--- a/appengine/isolate/handlers_frontend.py
+++ b/appengine/isolate/handlers_frontend.py
@@ -63,11 +63,24 @@ class RestrictedConfigHandler(auth.AuthenticatingHandler):
def get(self):
self.common(None)
+ @staticmethod
+ def cast_to_type(param_name, value):
+ def to_bool(value):
+ if type(value) is bool:
+ return value
+ return {'True': True, 'False': False}.get(value, False)
+
+ cast = {
+ 'enable_ts_monitoring': to_bool,
+ }.get(param_name, str)
+ return cast(value)
+
@auth.require(auth.is_admin)
def post(self):
# Convert MultiDict into a dict.
params = {
- k: self.request.params.getone(k) for k in self.request.params
+ k: self.cast_to_type(k, self.request.params.getone(k))
+ for k in self.request.params
if k not in ('keyid', 'xsrf_token')
}
cfg = config.settings(fresh=True)
« no previous file with comments | « no previous file | appengine/isolate/templates/restricted_config.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698