diff options
-rw-r--r-- | israwhidebroken/controllers.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/israwhidebroken/controllers.py b/israwhidebroken/controllers.py index a5e6c10..8e666ca 100644 --- a/israwhidebroken/controllers.py +++ b/israwhidebroken/controllers.py @@ -20,18 +20,14 @@ class Root(controllers.RootController): if not c: newest_tree = Tree.select(orderBy='-compose_id')[0] c = newest_tree.compose_id + # FIXME BLUH WIDGETIFY THIS return dict(in_qa='qa' in identity.current.groups, admin='qa-admin' in identity.current.groups, c=c, tests=Test.select(), trees=Tree.select(Tree.q.compose_id == c)) - # JSON RPC calls - @expose(allow_json=True) - def list_tests(self): - tests = Test.select() - return dict(tests=list(tests)) - + # Helpers for JSON calls def _tree_select(self, *args, **kw): qlist = [] for field in 'id', 'arch', 'compose_id', 'tree_time', 'repodata_time': @@ -43,6 +39,12 @@ class Root(controllers.RootController): print qlist return Tree.select(' AND '.join(qlist)) + # JSON RPC calls + @expose(allow_json=True) + def get_tests(self): + tests = Test.select() + return dict(tests=list(tests)) + @expose(allow_json=True) def get_trees(self, *args, **kw): tree_results = self._tree_select(*args, **kw) @@ -65,7 +67,10 @@ class Root(controllers.RootController): @identity.require(identity.in_group("qa")) @expose(allow_json=True) - def add_result(self, treeid, testid, result): + def add_result(self, treeid, testid, result, overwrite=False): + if not overwrite: + # TODO return an error if there's already a result here + pass tr = TestResult(tree=to_int(treeid), test=to_int(testid), result=to_int(result), |