Various changes to support further high-level automation efforts.

* added a RESTful interface for TKO.  right now there's only a single, simple resource for accessing test attributes.
* extended the REST server library in a few ways, most notably to support
* querying on keyvals, with something like ?has_keyval=mykey=myvalue&...
* operators, delimited by a colon, like ?hostname:in=host1,host2,host3
* loading relationships over many items efficiently (see InstanceEntry.prepare_for_full_representation()).  this is used to fill in keyvals when requesting a job listing, but it can (and should) be used in other places, such as listing labels for a host collection.
* loading a collection with inlined full representations, by passing full_representations=true
* added various features to the AFE RESTful interface as necessary.
* various fixes to the rest_client library, most notably
* changed HTTP client in rest_client.py to use DI rather than singleton, easing testability.  the same should be done for _get_request_headers(), to be honest.
* better support for query params, including accepting a MultiValueDict and supporting URIs that already have query args
* basic support for redirects
* builtin support for requesting a full collection (get_full()), when clients explicitly expect the result not to be paged.  i'm still considering alternative approaches to this -- it may make sense to have something like this be the default, and have clients set a default page size limit rather than passing it every time.
* minor change to mock.py to provide better debugging output.

Signed-off-by: Steve Howard <showard@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@4438 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/tko/urls.py b/frontend/tko/urls.py
index 5add77d..2124486 100644
--- a/frontend/tko/urls.py
+++ b/frontend/tko/urls.py
@@ -1,15 +1,26 @@
 from django.conf.urls import defaults
 import common
 from autotest_lib.frontend import settings, urls_common
+from autotest_lib.frontend.tko import resources
 
 urlpatterns, debug_patterns = (
         urls_common.generate_patterns('frontend.tko', 'TkoClient'))
 
+resource_patterns = defaults.patterns(
+        '',
+        (r'^/?$', resources.ResourceDirectory.dispatch_request),
+        (r'^test_results/?$', resources.TestResultCollection.dispatch_request),
+        (r'^test_results/(?P<test_id>\d+)/?$',
+         resources.TestResult.dispatch_request),
+        )
+
 urlpatterns += defaults.patterns(
         '',
         (r'^jsonp_rpc/', 'frontend.tko.views.handle_jsonp_rpc'),
         (r'^csv/', 'frontend.tko.views.handle_csv'),
-        (r'^plot/', 'frontend.tko.views.handle_plot'))
+        (r'^plot/', 'frontend.tko.views.handle_plot'),
+
+        (r'^resources/', defaults.include(resource_patterns)))
 
 if settings.DEBUG:
     urlpatterns += debug_patterns