diff options
author | Michael Hudson-Doyle <michael.hudson@linaro.org> | 2012-12-13 14:55:12 +1300 |
---|---|---|
committer | Michael Hudson-Doyle <michael.hudson@linaro.org> | 2012-12-13 14:55:12 +1300 |
commit | c6e6b2692925dabd0cda05a96dbfaed7973a4ed8 (patch) | |
tree | 46b8267b2affb6931e5464a1ec14505319aa21a6 | |
parent | 764e9449fb72e6fe4dc66c87885491dbde607dc4 (diff) |
initial (stupid) filter api!
-rw-r--r-- | dashboard_app/xmlrpc.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/dashboard_app/xmlrpc.py b/dashboard_app/xmlrpc.py index a4cfdde72..b56484f6d 100644 --- a/dashboard_app/xmlrpc.py +++ b/dashboard_app/xmlrpc.py @@ -22,6 +22,7 @@ XMP-RPC API import decimal import logging +import simplejson import xmlrpclib from django.contrib.auth.models import User, Group @@ -34,11 +35,13 @@ from linaro_django_xmlrpc.models import ( ) from dashboard_app import __version__ +from dashboard_app.filters import evaluate_filter from dashboard_app.models import ( Bundle, BundleStream, DataView, Test, + TestRunFilter, ) @@ -718,6 +721,11 @@ class DashboardAPI(ExposedAPI): } for item in columns] } + def filter_data(self, filter_name, count): + filter = TestRunFilter.objects.get(name=filter_name) + matches = evaluate_filter(self.user, filter.as_data())[:count] + return simplejson.dumps([match.serializable() for match in matches]) + # Mapper used by the legacy URL legacy_mapper = Mapper() |