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

Unified Diff: gm/rebaseline_server/server.py

Issue 26659002: rebaseline_server: extend returned JSON dict to allow for result-editing in coming CL (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: tabs_to_spaces Created 7 years, 2 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: gm/rebaseline_server/server.py
===================================================================
--- gm/rebaseline_server/server.py (revision 11659)
+++ gm/rebaseline_server/server.py (working copy)
@@ -79,6 +79,11 @@
self._port = port
self._export = export
+ def is_exported(self):
+ """ Returns true iff HTTP clients on other hosts are allowed to access
+ this server. """
+ return self._export
+
def fetch_results(self):
""" Create self.results, based on the expectations in
self._expectations_dir and the latest actuals from skia-autogen.
@@ -150,8 +155,24 @@
TODO(epoger): Unless we start making use of result_type, remove that
parameter."""
print 'do_GET_results: sending results of type "%s"' % result_type
+ # TODO(epoger): Cache response_dict rather than the results object, to save
+ # time on subsequent fetches (no need to regenerate the header, etc.)
response_dict = _SERVER.results.GetAll()
if response_dict:
+ response_dict["header"] = {
+ # Hash of testData, which the client must return with any edits--
+ # this ensures that the edits were made to a particular dataset.
+ "data-hash": str(hash(repr(response_dict["testData"]))),
+
+ # Whether the server will accept edits back.
+ # TODO(epoger): Not yet implemented, so hardcoding to False;
+ # once we implement the "browseonly" mode discussed in
+ # https://codereview.chromium.org/24274003/#msg6 , this value will vary.
+ "isEditable": False,
+
+ # Whether the service is accessible from other hosts.
+ "isExported": _SERVER.is_exported(),
+ }
self.send_json_dict(response_dict)
else:
self.send_error(404)

Powered by Google App Engine
This is Rietveld 408576698