13252.2.1
by Jeroen Vermeulen
Clean up queue view and tests a bit, preload more data. |
1 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
4 |
"""The `PackagesetSources` linking table.
|
|
5 |
||
6 |
This table associates `Packageset`s with `SourcePackageName`s.
|
|
7 |
"""
|
|
8 |
||
9 |
__metaclass__ = type |
|
10 |
__all__ = [ |
|
11 |
'PackagesetSources', |
|
12 |
]
|
|
13 |
||
14 |
from storm.locals import ( |
|
15 |
Int, |
|
16 |
Reference, |
|
17 |
Storm, |
|
18 |
)
|
|
19 |
||
20 |
||
21 |
class PackagesetSources(Storm): |
|
22 |
"""Linking table: which packages are in a package set?"""
|
|
23 |
# This table is largely managed from Packageset, but also directly
|
|
24 |
# accessed from other places.
|
|
25 |
||
26 |
__storm_table__ = 'PackagesetSources' |
|
27 |
||
28 |
# There's a vestigial id as well, a holdover from the SQLObject
|
|
29 |
# days. Nobody seems to use it. The only key that matters is
|
|
30 |
# (packageset, sourcepackagename).
|
|
13252.2.5
by Jeroen Vermeulen
Review change. |
31 |
# XXX JeroenVermeulen 2011-06-22, bug=800677: Drop the id column.
|
13252.2.1
by Jeroen Vermeulen
Clean up queue view and tests a bit, preload more data. |
32 |
__storm_primary__ = ( |
33 |
'packageset_id', |
|
34 |
'sourcepackagename_id', |
|
35 |
)
|
|
36 |
||
37 |
packageset_id = Int(name='packageset') |
|
38 |
packageset = Reference(packageset_id, 'Packageset.id') |
|
39 |
sourcepackagename_id = Int(name='sourcepackagename') |
|
40 |
sourcepackagename = Reference( |
|
41 |
sourcepackagename_id, 'SourcePackageName.id') |
|
13344.2.1
by Jeroen Vermeulen
Filter DistroSeriesDifferences query by Packageset. |
42 |
|
43 |
def __init__(self, packageset, sourcepackagename): |
|
44 |
self.packageset = packageset |
|
45 |
self.sourcepackagename = sourcepackagename |