summaryrefslogtreecommitdiffstats
path: root/israwhidebroken
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-09-16 17:39:09 -0400
committerWill Woods <wwoods@redhat.com>2009-09-16 17:39:09 -0400
commit7b88a0d4e8d72af06358f685c06e20ed705711d1 (patch)
tree53727c5fbb8e55b9703d0254f4a32ca8868c3ff2 /israwhidebroken
parent78d6dd2fea33326a60c1aca851bd23a0b529a6f1 (diff)
downloadisrawhidebroken-7b88a0d4e8d72af06358f685c06e20ed705711d1.tar.gz
israwhidebroken-7b88a0d4e8d72af06358f685c06e20ed705711d1.tar.xz
israwhidebroken-7b88a0d4e8d72af06358f685c06e20ed705711d1.zip
try to fix up add_tree
Diffstat (limited to 'israwhidebroken')
-rw-r--r--israwhidebroken/controllers.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/israwhidebroken/controllers.py b/israwhidebroken/controllers.py
index 6e1c90a..cbe317a 100644
--- a/israwhidebroken/controllers.py
+++ b/israwhidebroken/controllers.py
@@ -32,34 +32,44 @@ class Root(controllers.RootController):
tests = Test.select()
return dict(tests=list(tests))
- @expose(allow_json=True)
- def get_trees(self, *args, **kw):
+ def _tree_select(self, *args, **kw):
qlist = []
for field in 'arch', 'compose_id', 'tree_time', 'repodata_time':
if field in kw:
qlist.append('%s == %s' % (field, Tree.sqlrepr(kw[field])))
- tree_results = Tree.select(' AND '.join(qlist))
- return dict(trees=list(tree_results))
+ return Tree.select(' AND '.join(qlist))
@expose(allow_json=True)
+ def get_trees(self, *args, **kw):
+ tree_results = self._tree_select(*args, **kw)
+ return dict(trees=list(tree_results))
+
@identity.require(identity.in_group("qa-admin"))
+ @expose(allow_json=True)
def add_tree(self, arch, compose_id, tree_time=None, repodata_time=None):
+ # check to see if tree already exists
+ tree_result = self._tree_select(arch=arch, compose_id=compose_id,
+ tree_time=tree_time, repodata_time=repodata_time)
+ if tree_result.count():
+ return dict(exc='ValueError', tg_flash='Tree exists')
t = Tree(arch=arch,
- compose_id=compose_id,
- tree_time=tree_time,
- repodata_time=repodata_time)
+ compose_id=to_int(compose_id),
+ tree_time=to_int(tree_time),
+ repodata_time=to_int(repodata_time))
hub.commit()
return dict(tree=t)
- @expose(allow_json=True)
@identity.require(identity.in_group("qa"))
+ @expose(allow_json=True)
def add_result(self, treeid, testid, result):
- tr = TestResult(tree=treeid, test=testid, result=result)
+ tr = TestResult(tree=to_int(treeid),
+ test=to_int(testid),
+ result=to_int(result))
hub.commit() # XXX redundant?
return dict(id=tr.id)
- @expose(allow_json=True)
@identity.require(identity.in_group("qa-admin"))
+ @expose(allow_json=True)
def delete_result(self, id):
return dict(youwantedtodelete=id, thisisastub=True)