blob: 6e8bcbdea8c4b3a96be862f8d875c5b2671044d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
from datetime import datetime
import pkg_resources
pkg_resources.require("SQLObject>=0.10.1")
from turbogears.database import PackageHub
# import some basic SQLObject classes for declaring the data model
# (see http://www.sqlobject.org/SQLObject.html#declaring-the-class)
from sqlobject import SQLObject, SQLObjectNotFound, MultipleJoin, RelatedJoin
# import some datatypes for table columns from SQLObject
# (see http://www.sqlobject.org/SQLObject.html#column-types for more)
from sqlobject import StringCol, UnicodeCol, IntCol, DateTimeCol, ForeignKey
from turbogears import identity
__connection__ = hub = PackageHub('israwhidebroken')
# your data model
class Tree(SQLObject):
arch = StringCol(length=10, notNone=True)
# These could be null if repodata/images are missing
tree_time = DateTimeCol()
repodata_time = DateTimeCol()
# A tree can have many results you might want to look at
results = MultipleJoin('TestResult')
class Test(SQLObject):
name = StringCol(notNone=True, unique=True)
short_desc = StringCol(notNone=True)
uri = StringCol(notNone=True)
# Tests also have many results but we don't usually care about viewing
# every single test result ever for a given test. Hence no join here.
class TestResult(SQLObject):
# References to other objects - each test result comes from running one
# Test on a given Tree.
test = ForeignKey('Test')
tree = ForeignKey('Tree')
# result is just an int - 0 for fail, >= 1 for pass.
# It's not a float 'cuz we don't have any performance tests in RATS.
# XXX - How do we want to handle WARN or ERROR?
result = IntCol(notNone=True)
# bug_id for further information, esp. if the test is a fail.
# XXX list of bug IDs?
bug_id = IntCol()
# timestamp this result was entered
timestamp = DateTimeCol(notNone=True)
|