Index: gm/rebaseline_server/server.py |
=================================================================== |
--- gm/rebaseline_server/server.py (revision 11711) |
+++ gm/rebaseline_server/server.py (working copy) |
@@ -17,6 +17,7 @@ |
import posixpath |
import re |
import shutil |
+import string |
import sys |
# Imports from within Skia |
@@ -127,7 +128,7 @@ |
""" Handles all GET requests, forwarding them to the appropriate |
do_GET_* dispatcher. """ |
if self.path == '' or self.path == '/' or self.path == '/index.html' : |
- self.redirect_to('/static/view.html') |
+ self.redirect_to('/static/view.html?resultsToLoad=all') |
return |
if self.path == '/favicon.ico' : |
self.redirect_to('/static/favicon.ico') |
@@ -146,21 +147,16 @@ |
dispatcher = dispatchers[dispatcher_name] |
dispatcher(remainder) |
- def do_GET_results(self, result_type): |
+ def do_GET_results(self, type): |
""" Handle a GET request for GM results. |
- For now, we ignore the remaining path info, because we only know how to |
- return all results. |
Args: |
- result_type: currently unused |
- |
- 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: |
+ type: string indicating which set of results to return; |
+ must be one of the results.RESULTS_* constants |
+ """ |
+ print 'do_GET_results: sending results of type "%s"' % type |
jcgregorio
2013/10/10 19:59:11
Can we use the logging module instead of print?
epoger
2013/10/11 17:44:49
Done.
|
+ try: |
+ response_dict = _SERVER.results.get_results_of_type(type) |
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. |
@@ -176,7 +172,7 @@ |
'isExported': _SERVER.is_exported(), |
} |
self.send_json_dict(response_dict) |
- else: |
+ except: |
self.send_error(404) |
def do_GET_static(self, path): |
@@ -187,6 +183,9 @@ |
Args: |
path: path to file (under static directory) to retrieve |
""" |
+ i = string.find(path, '?') |
jcgregorio
2013/10/10 19:59:11
path = urlparse.urlparse(path).path
epoger
2013/10/11 17:44:49
done.done
|
+ if i >= 0: |
+ path = path[:i] |
print 'do_GET_static: sending file "%s"' % path |
static_dir = os.path.realpath(os.path.join(PARENT_DIRECTORY, 'static')) |
full_path = os.path.realpath(os.path.join(static_dir, path)) |