8687.15.17
by Karl Fogel
Add the copyright header block to the rest of the files under lib/lp/. |
1 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
4983.1.2
by Curtis Hovey
Added pylint exceptions to database classes. |
4 |
# pylint: disable-msg=E0611,W0212
|
1670
by Canonical.com Patch Queue Manager
Big lot of database clean-up r=stub except for resolution of conflicts. |
5 |
|
6 |
__metaclass__ = type |
|
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
7 |
__all__ = [ |
8 |
'Section', |
|
3139.2.2
by Celso Providelo
Merge from carlos, rosetta queue imports |
9 |
'SectionSelection', |
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
10 |
'SectionSet'
|
11 |
]
|
|
1670
by Canonical.com Patch Queue Manager
Big lot of database clean-up r=stub except for resolution of conflicts. |
12 |
|
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
13 |
from sqlobject import ( |
14 |
ForeignKey, |
|
15 |
StringCol, |
|
16 |
)
|
|
1460
by Canonical.com Patch Queue Manager
Got away with soyuz.py from database, interfaces and browser, and distroarchrelease.zcml clean up. |
17 |
from zope.interface import implements |
18 |
||
19 |
from canonical.database.sqlbase import SQLBase |
|
11270.1.3
by Tim Penhey
Changed NotFoundError imports - gee there were a lot of them. |
20 |
from lp.app.errors import NotFoundError |
8303.14.17
by Julian Edwards
Fix the components-and-sections doctest. |
21 |
from lp.soyuz.interfaces.section import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
22 |
ISection, |
23 |
ISectionSelection, |
|
24 |
ISectionSet, |
|
25 |
)
|
|
8303.14.17
by Julian Edwards
Fix the components-and-sections doctest. |
26 |
|
8447.1.2
by Jonathan Lange
Fix up lots of lint, including removing code that's been disabled forever. |
27 |
|
1460
by Canonical.com Patch Queue Manager
Got away with soyuz.py from database, interfaces and browser, and distroarchrelease.zcml clean up. |
28 |
class Section(SQLBase): |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
29 |
"""See ISection"""
|
1460
by Canonical.com Patch Queue Manager
Got away with soyuz.py from database, interfaces and browser, and distroarchrelease.zcml clean up. |
30 |
implements(ISection) |
1670
by Canonical.com Patch Queue Manager
Big lot of database clean-up r=stub except for resolution of conflicts. |
31 |
|
8447.1.2
by Jonathan Lange
Fix up lots of lint, including removing code that's been disabled forever. |
32 |
_defaultOrder = ['id'] |
3023.2.3
by Celso Providelo
Applying Review comments take 1 |
33 |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
34 |
name = StringCol(notNull=True, alternateID=True) |
1460
by Canonical.com Patch Queue Manager
Got away with soyuz.py from database, interfaces and browser, and distroarchrelease.zcml clean up. |
35 |
|
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
36 |
|
3139.2.2
by Celso Providelo
Merge from carlos, rosetta queue imports |
37 |
class SectionSelection(SQLBase): |
38 |
"""See ISectionSelection."""
|
|
39 |
||
40 |
implements(ISectionSelection) |
|
41 |
||
8447.1.2
by Jonathan Lange
Fix up lots of lint, including removing code that's been disabled forever. |
42 |
_defaultOrder = ['id'] |
3139.2.2
by Celso Providelo
Merge from carlos, rosetta queue imports |
43 |
|
5121.2.6
by Stuart Bishop
Some required code updates |
44 |
distroseries = ForeignKey(dbName='distroseries', |
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
45 |
foreignKey='DistroSeries', notNull=True) |
3139.2.2
by Celso Providelo
Merge from carlos, rosetta queue imports |
46 |
section = ForeignKey(dbName='section', |
47 |
foreignKey='Section', notNull=True) |
|
48 |
||
49 |
||
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
50 |
class SectionSet: |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
51 |
"""See ISectionSet."""
|
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
52 |
implements(ISectionSet) |
53 |
||
54 |
def __iter__(self): |
|
55 |
"""See ISectionSet."""
|
|
56 |
return iter(Section.select()) |
|
57 |
||
58 |
def __getitem__(self, name): |
|
59 |
"""See ISectionSet."""
|
|
2865.2.14
by Celso Providelo
re-enable ACL checks for known uploads proccessing, component and section on-the-fly creation permissions for uploader DB user in uploader-test, improving component section utilities (untested yet). |
60 |
section = Section.selectOneBy(name=name) |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
61 |
if section is not None: |
2865.2.14
by Celso Providelo
re-enable ACL checks for known uploads proccessing, component and section on-the-fly creation permissions for uploader DB user in uploader-test, improving component section utilities (untested yet). |
62 |
return section |
63 |
raise NotFoundError(name) |
|
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
64 |
|
65 |
def get(self, section_id): |
|
66 |
"""See ISectionSet."""
|
|
67 |
return Section.get(section_id) |
|
68 |
||
2865.2.14
by Celso Providelo
re-enable ACL checks for known uploads proccessing, component and section on-the-fly creation permissions for uploader DB user in uploader-test, improving component section utilities (untested yet). |
69 |
def ensure(self, name): |
70 |
"""See ISectionSet."""
|
|
71 |
section = Section.selectOneBy(name=name) |
|
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
72 |
if section is not None: |
2865.2.14
by Celso Providelo
re-enable ACL checks for known uploads proccessing, component and section on-the-fly creation permissions for uploader DB user in uploader-test, improving component section utilities (untested yet). |
73 |
return section |
74 |
return self.new(name) |
|
75 |
||
2865.2.11
by Celso Providelo
Check the existence of upload component & section, required respective Set utility classes, minimal changes approach, untested yet. |
76 |
def new(self, name): |
77 |
"""See ISectionSet."""
|
|
78 |
return Section(name=name) |
|
79 |