Merge lp:~jcsackett/launchpad/registry-errors-649836 into lp:launchpad
- registry-errors-649836
- Merge into devel
Status: | Merged |
---|---|
Approved by: | j.c.sackett |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11673 |
Proposed branch: | lp:~jcsackett/launchpad/registry-errors-649836 |
Merge into: | lp:launchpad |
Diff against target: |
1061 lines (+183/-178) 28 files modified
lib/canonical/launchpad/interfaces/__init__.py (+0/-1) lib/canonical/launchpad/testing/pages.py (+2/-2) lib/lp/code/model/branchlookup.py (+4/-2) lib/lp/code/model/branchnamespace.py (+7/-9) lib/lp/code/model/linkedbranch.py (+1/-1) lib/lp/code/model/tests/test_branchlookup.py (+4/-2) lib/lp/code/model/tests/test_branchnamespace.py (+4/-2) lib/lp/code/model/tests/test_linkedbranch.py (+1/-1) lib/lp/code/xmlrpc/branch.py (+4/-2) lib/lp/registry/configure.zcml (+7/-0) lib/lp/registry/errors.py (+97/-1) lib/lp/registry/interfaces/distributionmirror.py (+6/-49) lib/lp/registry/interfaces/distroseries.py (+1/-9) lib/lp/registry/interfaces/person.py (+3/-21) lib/lp/registry/interfaces/sourcepackagename.py (+2/-10) lib/lp/registry/interfaces/structuralsubscription.py (+0/-16) lib/lp/registry/interfaces/teammembership.py (+0/-12) lib/lp/registry/model/distribution.py (+1/-2) lib/lp/registry/model/distributionmirror.py (+10/-9) lib/lp/registry/model/person.py (+2/-2) lib/lp/registry/model/sourcepackagename.py (+3/-4) lib/lp/registry/model/structuralsubscription.py (+4/-2) lib/lp/registry/model/teammembership.py (+4/-2) lib/lp/registry/tests/test_distribution.py (+1/-1) lib/lp/registry/tests/test_distroseries.py (+4/-10) lib/lp/registry/tests/test_person.py (+5/-3) lib/lp/registry/tests/test_structuralsubscriptiontarget.py (+4/-2) lib/lp/registry/tests/test_team_webservice.py (+2/-1) |
To merge this branch: | bzr merge lp:~jcsackett/launchpad/registry-errors-649836 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Edwin Grubbs (community) | code | Approve | |
Review via email: mp+36994@code.launchpad.net |
Commit message
Creates an lp.registry.errors module to collect and register exceptions used by the webservice.
Description of the change
Summary
=======
Cleans up the webservice exceptions in registry by moving them all to lp.registry.errors and registering that module with the webservice. This helps our ongoing efforts to get away from circular import problems and start moving things out of canonical.
Proposed Fix
============
Create an lp.registry.errors module and move all exceptions with the webservice_error directive in them to this module. Register the new module in lp/registry/
Pre-Implementation Talk
=======
Spoke with Curtis Hovey about restricting the scope of the branch since there's substantially more we'll want to move into errors over time.
Implementation details
=======
As in proposed.
Tests
=====
bin/test -m lp.registry
bin/test -t webservice
Demo and Q/A
============
This is largely not demo-able; everything over the webservice should continue to work largely as it has, with the exception of a few changed error codes. (400 -> more specific errors)
Lint
====
make lint output:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/canonical
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
./lib/canonical
460: E302 expected 2 blank lines, found 1
96: Line contains a call to pdb.
./lib/lp/
541: E301 expected 1 blank line, found 0
./lib/lp/
163: Line exceeds 78 characters.
169: Line exceeds 78 characters.
./lib/lp/
494: E302 expected 2 blank lines, found 1
./lib/lp/
1254: E231 missing whitespace after ','
1260: E231 missing whitespace after ','
1272: E231 missing whitespace after ','
1258: Line exceeds 78 characters.
./lib/lp/
589: E501 line too long (80 characters)
455: Line exceeds 78 characters.
473: Line exceeds 78 characters.
589: Line exceeds 78 characters.
807: Line exceeds 78 characters.
860: Line exceeds 78 characters.
./lib/lp/
148: W601 .has_key() is deprecated, use 'in'
This has touched so many files the lint output is all over the place; everything that's left is either lint complaining about valid things (e.g. commas in 1-tuples) or something I'm not sure should be altered. I have fixed everything that seems to related to my changes.
j.c.sackett (jcsackett) wrote : | # |
>> @@ -59,6 +56,7 @@
>> IHasBugs,
>> IHasOfficialBug
>> )
>> +from lp.registry.errors import NoSuchDistroSeries
>
>
>
> It looks like we could use a separate file for special form fields,
> since DistroSeriesNam
> benefit of moving that exception to lp.registry.errors, if we are just
> going to import it. Can you open a bug for that?
I can and will.
>> from lp.code.
>> +from lp.registry.errors import (
>> + PrivatePersonLi
>> + )
>
>
> Can you run utilities/
> in this branch? This import will fit on a single line.
Done.
Thanks for the review, Edwin.
Preview Diff
1 | === modified file 'lib/canonical/launchpad/interfaces/__init__.py' | |||
2 | --- lib/canonical/launchpad/interfaces/__init__.py 2010-09-28 15:20:09 +0000 | |||
3 | +++ lib/canonical/launchpad/interfaces/__init__.py 2010-10-04 12:14:48 +0000 | |||
4 | @@ -96,7 +96,6 @@ | |||
5 | 96 | from canonical.launchpad.interfaces.packagerelationship import * | 96 | from canonical.launchpad.interfaces.packagerelationship import * |
6 | 97 | from canonical.launchpad.interfaces.pathlookup import * | 97 | from canonical.launchpad.interfaces.pathlookup import * |
7 | 98 | from lp.registry.interfaces.poll import * | 98 | from lp.registry.interfaces.poll import * |
8 | 99 | from lp.registry.errors import TeamMembershipTransitionError | ||
9 | 100 | from lp.soyuz.interfaces.processor import * | 99 | from lp.soyuz.interfaces.processor import * |
10 | 101 | from lp.registry.interfaces.product import * | 100 | from lp.registry.interfaces.product import * |
11 | 102 | from lp.registry.interfaces.productlicense import * | 101 | from lp.registry.interfaces.productlicense import * |
12 | 103 | 102 | ||
13 | === modified file 'lib/canonical/launchpad/testing/pages.py' | |||
14 | --- lib/canonical/launchpad/testing/pages.py 2010-08-20 20:31:18 +0000 | |||
15 | +++ lib/canonical/launchpad/testing/pages.py 2010-10-04 12:14:48 +0000 | |||
16 | @@ -63,7 +63,7 @@ | |||
17 | 63 | from canonical.launchpad.webapp.interfaces import OAuthPermission | 63 | from canonical.launchpad.webapp.interfaces import OAuthPermission |
18 | 64 | from canonical.launchpad.webapp.url import urlsplit | 64 | from canonical.launchpad.webapp.url import urlsplit |
19 | 65 | from canonical.testing import PageTestLayer | 65 | from canonical.testing import PageTestLayer |
21 | 66 | from lp.registry.interfaces.person import NameAlreadyTaken | 66 | from lp.registry.errors import NameAlreadyTaken |
22 | 67 | from lp.testing import ( | 67 | from lp.testing import ( |
23 | 68 | ANONYMOUS, | 68 | ANONYMOUS, |
24 | 69 | launchpadlib_for, | 69 | launchpadlib_for, |
25 | @@ -329,7 +329,7 @@ | |||
26 | 329 | ( ) An unchecked option | 329 | ( ) An unchecked option |
27 | 330 | """ | 330 | """ |
28 | 331 | main = BeautifulSoup(content) | 331 | main = BeautifulSoup(content) |
30 | 332 | buttons = main.findAll( | 332 | buttons = main.findAll( |
31 | 333 | 'input', {'name': 'field.%s' % name}) | 333 | 'input', {'name': 'field.%s' % name}) |
32 | 334 | for button in buttons: | 334 | for button in buttons: |
33 | 335 | if button.parent.name == 'label': | 335 | if button.parent.name == 'label': |
34 | 336 | 336 | ||
35 | === modified file 'lib/lp/code/model/branchlookup.py' | |||
36 | --- lib/lp/code/model/branchlookup.py 2010-08-20 20:31:18 +0000 | |||
37 | +++ lib/lp/code/model/branchlookup.py 2010-10-04 12:14:48 +0000 | |||
38 | @@ -48,11 +48,14 @@ | |||
39 | 48 | from lp.code.interfaces.branchnamespace import IBranchNamespaceSet | 48 | from lp.code.interfaces.branchnamespace import IBranchNamespaceSet |
40 | 49 | from lp.code.interfaces.linkedbranch import get_linked_to_branch | 49 | from lp.code.interfaces.linkedbranch import get_linked_to_branch |
41 | 50 | from lp.code.model.branch import Branch | 50 | from lp.code.model.branch import Branch |
42 | 51 | from lp.registry.errors import ( | ||
43 | 52 | NoSuchDistroSeries, | ||
44 | 53 | NoSuchSourcePackageName, | ||
45 | 54 | ) | ||
46 | 51 | from lp.registry.interfaces.distribution import IDistribution | 55 | from lp.registry.interfaces.distribution import IDistribution |
47 | 52 | from lp.registry.interfaces.distroseries import ( | 56 | from lp.registry.interfaces.distroseries import ( |
48 | 53 | IDistroSeries, | 57 | IDistroSeries, |
49 | 54 | IDistroSeriesSet, | 58 | IDistroSeriesSet, |
50 | 55 | NoSuchDistroSeries, | ||
51 | 56 | ) | 59 | ) |
52 | 57 | from lp.registry.interfaces.person import NoSuchPerson | 60 | from lp.registry.interfaces.person import NoSuchPerson |
53 | 58 | from lp.registry.interfaces.pillar import IPillarNameSet | 61 | from lp.registry.interfaces.pillar import IPillarNameSet |
54 | @@ -62,7 +65,6 @@ | |||
55 | 62 | NoSuchProduct, | 65 | NoSuchProduct, |
56 | 63 | ) | 66 | ) |
57 | 64 | from lp.registry.interfaces.productseries import NoSuchProductSeries | 67 | from lp.registry.interfaces.productseries import NoSuchProductSeries |
58 | 65 | from lp.registry.interfaces.sourcepackagename import NoSuchSourcePackageName | ||
59 | 66 | from lp.registry.model.distribution import Distribution | 68 | from lp.registry.model.distribution import Distribution |
60 | 67 | from lp.registry.model.distroseries import DistroSeries | 69 | from lp.registry.model.distroseries import DistroSeries |
61 | 68 | from lp.registry.model.person import Person | 70 | from lp.registry.model.person import Person |
62 | 69 | 71 | ||
63 | === modified file 'lib/lp/code/model/branchnamespace.py' | |||
64 | --- lib/lp/code/model/branchnamespace.py 2010-08-20 20:31:18 +0000 | |||
65 | +++ lib/lp/code/model/branchnamespace.py 2010-10-04 12:14:48 +0000 | |||
66 | @@ -51,14 +51,15 @@ | |||
67 | 51 | ) | 51 | ) |
68 | 52 | from lp.code.interfaces.branchtarget import IBranchTarget | 52 | from lp.code.interfaces.branchtarget import IBranchTarget |
69 | 53 | from lp.code.model.branch import Branch | 53 | from lp.code.model.branch import Branch |
70 | 54 | from lp.registry.errors import ( | ||
71 | 55 | NoSuchDistroSeries, | ||
72 | 56 | NoSuchSourcePackageName, | ||
73 | 57 | ) | ||
74 | 54 | from lp.registry.interfaces.distribution import ( | 58 | from lp.registry.interfaces.distribution import ( |
75 | 55 | IDistributionSet, | 59 | IDistributionSet, |
76 | 56 | NoSuchDistribution, | 60 | NoSuchDistribution, |
77 | 57 | ) | 61 | ) |
82 | 58 | from lp.registry.interfaces.distroseries import ( | 62 | from lp.registry.interfaces.distroseries import IDistroSeriesSet |
79 | 59 | IDistroSeriesSet, | ||
80 | 60 | NoSuchDistroSeries, | ||
81 | 61 | ) | ||
83 | 62 | from lp.registry.interfaces.person import ( | 63 | from lp.registry.interfaces.person import ( |
84 | 63 | IPersonSet, | 64 | IPersonSet, |
85 | 64 | NoSuchPerson, | 65 | NoSuchPerson, |
86 | @@ -70,10 +71,7 @@ | |||
87 | 70 | NoSuchProduct, | 71 | NoSuchProduct, |
88 | 71 | ) | 72 | ) |
89 | 72 | from lp.registry.interfaces.projectgroup import IProjectGroup | 73 | from lp.registry.interfaces.projectgroup import IProjectGroup |
94 | 73 | from lp.registry.interfaces.sourcepackagename import ( | 74 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet |
91 | 74 | ISourcePackageNameSet, | ||
92 | 75 | NoSuchSourcePackageName, | ||
93 | 76 | ) | ||
95 | 77 | from lp.registry.model.sourcepackage import SourcePackage | 75 | from lp.registry.model.sourcepackage import SourcePackage |
96 | 78 | from lp.services.utils import iter_split | 76 | from lp.services.utils import iter_split |
97 | 79 | 77 | ||
98 | @@ -302,7 +300,7 @@ | |||
99 | 302 | @property | 300 | @property |
100 | 303 | def name(self): | 301 | def name(self): |
101 | 304 | """See `IBranchNamespace`.""" | 302 | """See `IBranchNamespace`.""" |
103 | 305 | return '~%s/+junk' % (self.owner.name,) | 303 | return '~%s/+junk' % self.owner.name |
104 | 306 | 304 | ||
105 | 307 | def canBranchesBePrivate(self): | 305 | def canBranchesBePrivate(self): |
106 | 308 | """See `IBranchNamespace`.""" | 306 | """See `IBranchNamespace`.""" |
107 | 309 | 307 | ||
108 | === modified file 'lib/lp/code/model/linkedbranch.py' | |||
109 | --- lib/lp/code/model/linkedbranch.py 2010-08-20 20:31:18 +0000 | |||
110 | +++ lib/lp/code/model/linkedbranch.py 2010-10-04 12:14:48 +0000 | |||
111 | @@ -17,10 +17,10 @@ | |||
112 | 17 | 17 | ||
113 | 18 | from lp.archivepublisher.debversion import Version | 18 | from lp.archivepublisher.debversion import Version |
114 | 19 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch | 19 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch |
115 | 20 | from lp.registry.errors import NoSuchDistroSeries | ||
116 | 20 | from lp.registry.interfaces.distributionsourcepackage import ( | 21 | from lp.registry.interfaces.distributionsourcepackage import ( |
117 | 21 | IDistributionSourcePackage, | 22 | IDistributionSourcePackage, |
118 | 22 | ) | 23 | ) |
119 | 23 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | ||
120 | 24 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 24 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
121 | 25 | from lp.registry.interfaces.product import IProduct | 25 | from lp.registry.interfaces.product import IProduct |
122 | 26 | from lp.registry.interfaces.productseries import IProductSeries | 26 | from lp.registry.interfaces.productseries import IProductSeries |
123 | 27 | 27 | ||
124 | === modified file 'lib/lp/code/model/tests/test_branchlookup.py' | |||
125 | --- lib/lp/code/model/tests/test_branchlookup.py 2010-09-16 04:43:45 +0000 | |||
126 | +++ lib/lp/code/model/tests/test_branchlookup.py 2010-10-04 12:14:48 +0000 | |||
127 | @@ -26,7 +26,10 @@ | |||
128 | 26 | ) | 26 | ) |
129 | 27 | from lp.code.interfaces.branchnamespace import get_branch_namespace | 27 | from lp.code.interfaces.branchnamespace import get_branch_namespace |
130 | 28 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch | 28 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch |
132 | 29 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | 29 | from lp.registry.errors import ( |
133 | 30 | NoSuchDistroSeries, | ||
134 | 31 | NoSuchSourcePackageName, | ||
135 | 32 | ) | ||
136 | 30 | from lp.registry.interfaces.person import NoSuchPerson | 33 | from lp.registry.interfaces.person import NoSuchPerson |
137 | 31 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 34 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
138 | 32 | from lp.registry.interfaces.product import ( | 35 | from lp.registry.interfaces.product import ( |
139 | @@ -34,7 +37,6 @@ | |||
140 | 34 | NoSuchProduct, | 37 | NoSuchProduct, |
141 | 35 | ) | 38 | ) |
142 | 36 | from lp.registry.interfaces.productseries import NoSuchProductSeries | 39 | from lp.registry.interfaces.productseries import NoSuchProductSeries |
143 | 37 | from lp.registry.interfaces.sourcepackagename import NoSuchSourcePackageName | ||
144 | 38 | from lp.testing import ( | 40 | from lp.testing import ( |
145 | 39 | run_with_login, | 41 | run_with_login, |
146 | 40 | TestCaseWithFactory, | 42 | TestCaseWithFactory, |
147 | 41 | 43 | ||
148 | === modified file 'lib/lp/code/model/tests/test_branchnamespace.py' | |||
149 | --- lib/lp/code/model/tests/test_branchnamespace.py 2010-08-20 20:31:18 +0000 | |||
150 | +++ lib/lp/code/model/tests/test_branchnamespace.py 2010-10-04 12:14:48 +0000 | |||
151 | @@ -39,11 +39,13 @@ | |||
152 | 39 | PersonalNamespace, | 39 | PersonalNamespace, |
153 | 40 | ProductNamespace, | 40 | ProductNamespace, |
154 | 41 | ) | 41 | ) |
155 | 42 | from lp.registry.errors import ( | ||
156 | 43 | NoSuchDistroSeries, | ||
157 | 44 | NoSuchSourcePackageName, | ||
158 | 45 | ) | ||
159 | 42 | from lp.registry.interfaces.distribution import NoSuchDistribution | 46 | from lp.registry.interfaces.distribution import NoSuchDistribution |
160 | 43 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | ||
161 | 44 | from lp.registry.interfaces.person import NoSuchPerson | 47 | from lp.registry.interfaces.person import NoSuchPerson |
162 | 45 | from lp.registry.interfaces.product import NoSuchProduct | 48 | from lp.registry.interfaces.product import NoSuchProduct |
163 | 46 | from lp.registry.interfaces.sourcepackagename import NoSuchSourcePackageName | ||
164 | 47 | from lp.registry.model.sourcepackage import SourcePackage | 49 | from lp.registry.model.sourcepackage import SourcePackage |
165 | 48 | from lp.testing import TestCaseWithFactory | 50 | from lp.testing import TestCaseWithFactory |
166 | 49 | 51 | ||
167 | 50 | 52 | ||
168 | === modified file 'lib/lp/code/model/tests/test_linkedbranch.py' | |||
169 | --- lib/lp/code/model/tests/test_linkedbranch.py 2010-08-20 20:31:18 +0000 | |||
170 | +++ lib/lp/code/model/tests/test_linkedbranch.py 2010-10-04 12:14:48 +0000 | |||
171 | @@ -18,7 +18,7 @@ | |||
172 | 18 | get_linked_to_branch, | 18 | get_linked_to_branch, |
173 | 19 | ICanHasLinkedBranch, | 19 | ICanHasLinkedBranch, |
174 | 20 | ) | 20 | ) |
176 | 21 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | 21 | from lp.registry.errors import NoSuchDistroSeries |
177 | 22 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 22 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
178 | 23 | from lp.testing import ( | 23 | from lp.testing import ( |
179 | 24 | run_with_login, | 24 | run_with_login, |
180 | 25 | 25 | ||
181 | === modified file 'lib/lp/code/xmlrpc/branch.py' | |||
182 | --- lib/lp/code/xmlrpc/branch.py 2010-09-07 05:39:39 +0000 | |||
183 | +++ lib/lp/code/xmlrpc/branch.py 2010-10-04 12:14:48 +0000 | |||
184 | @@ -52,7 +52,10 @@ | |||
185 | 52 | compose_public_url, | 52 | compose_public_url, |
186 | 53 | SUPPORTED_SCHEMES, | 53 | SUPPORTED_SCHEMES, |
187 | 54 | ) | 54 | ) |
189 | 55 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | 55 | from lp.registry.errors import ( |
190 | 56 | NoSuchDistroSeries, | ||
191 | 57 | NoSuchSourcePackageName, | ||
192 | 58 | ) | ||
193 | 56 | from lp.registry.interfaces.person import ( | 59 | from lp.registry.interfaces.person import ( |
194 | 57 | IPersonSet, | 60 | IPersonSet, |
195 | 58 | NoSuchPerson, | 61 | NoSuchPerson, |
196 | @@ -63,7 +66,6 @@ | |||
197 | 63 | NoSuchProduct, | 66 | NoSuchProduct, |
198 | 64 | ) | 67 | ) |
199 | 65 | from lp.registry.interfaces.productseries import NoSuchProductSeries | 68 | from lp.registry.interfaces.productseries import NoSuchProductSeries |
200 | 66 | from lp.registry.interfaces.sourcepackagename import NoSuchSourcePackageName | ||
201 | 67 | 69 | ||
202 | 68 | 70 | ||
203 | 69 | class IBranchSetAPI(Interface): | 71 | class IBranchSetAPI(Interface): |
204 | 70 | 72 | ||
205 | === modified file 'lib/lp/registry/configure.zcml' | |||
206 | --- lib/lp/registry/configure.zcml 2010-09-30 03:39:35 +0000 | |||
207 | +++ lib/lp/registry/configure.zcml 2010-10-04 12:14:48 +0000 | |||
208 | @@ -8,6 +8,7 @@ | |||
209 | 8 | xmlns:i18n="http://namespaces.zope.org/i18n" | 8 | xmlns:i18n="http://namespaces.zope.org/i18n" |
210 | 9 | xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" | 9 | xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" |
211 | 10 | xmlns:lp="http://namespaces.canonical.com/lp" | 10 | xmlns:lp="http://namespaces.canonical.com/lp" |
212 | 11 | xmlns:webservice="http://namespaces.canonical.com/webservice" | ||
213 | 11 | i18n_domain="launchpad"> | 12 | i18n_domain="launchpad"> |
214 | 12 | <include | 13 | <include |
215 | 13 | file="vocabularies.zcml"/> | 14 | file="vocabularies.zcml"/> |
216 | @@ -1872,6 +1873,12 @@ | |||
217 | 1872 | interface="lp.registry.interfaces.personproduct.IPersonProduct"/> | 1873 | interface="lp.registry.interfaces.personproduct.IPersonProduct"/> |
218 | 1873 | </class> | 1874 | </class> |
219 | 1874 | 1875 | ||
220 | 1876 | <!-- Registers exceptions used in webservice defined in lp.registry. | ||
221 | 1877 | Other data is in module=canonical.launchpad.interfaces as defined in | ||
222 | 1878 | zcml there.--> | ||
223 | 1879 | |||
224 | 1880 | <webservice:register module="lp.registry.errors" /> | ||
225 | 1881 | |||
226 | 1875 | <adapter | 1882 | <adapter |
227 | 1876 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" | 1883 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
228 | 1877 | for="lp.registry.interfaces.personproduct.IPersonProduct" | 1884 | for="lp.registry.interfaces.personproduct.IPersonProduct" |
229 | 1878 | 1885 | ||
230 | === modified file 'lib/lp/registry/errors.py' | |||
231 | --- lib/lp/registry/errors.py 2010-09-28 15:14:38 +0000 | |||
232 | +++ lib/lp/registry/errors.py 2010-10-04 12:14:48 +0000 | |||
233 | @@ -1,14 +1,110 @@ | |||
235 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the |
236 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
237 | 3 | 3 | ||
238 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
239 | 5 | __all__ = [ | 5 | __all__ = [ |
240 | 6 | 'PrivatePersonLinkageError', | ||
241 | 7 | 'NameAlreadyTaken', | ||
242 | 8 | 'NoSuchDistroSeries', | ||
243 | 9 | 'UserCannotChangeMembershipSilently', | ||
244 | 10 | 'NoSuchSourcePackageName', | ||
245 | 11 | 'CannotTransitionToCountryMirror', | ||
246 | 12 | 'CountryMirrorAlreadySet', | ||
247 | 13 | 'MirrorNotOfficial', | ||
248 | 14 | 'MirrorHasNoHTTPURL', | ||
249 | 15 | 'MirrorNotProbed', | ||
250 | 16 | 'DeleteSubscriptionError', | ||
251 | 17 | 'UserCannotSubscribePerson', | ||
252 | 6 | 'TeamMembershipTransitionError', | 18 | 'TeamMembershipTransitionError', |
253 | 7 | ] | 19 | ] |
254 | 8 | 20 | ||
255 | 9 | import httplib | 21 | import httplib |
256 | 10 | 22 | ||
257 | 11 | from lazr.restful.declarations import webservice_error | 23 | from lazr.restful.declarations import webservice_error |
258 | 24 | from zope.security.interfaces import Unauthorized | ||
259 | 25 | |||
260 | 26 | from lp.app.errors import NameLookupFailed | ||
261 | 27 | |||
262 | 28 | |||
263 | 29 | class PrivatePersonLinkageError(ValueError): | ||
264 | 30 | """An attempt was made to link a private person/team to something.""" | ||
265 | 31 | webservice_error(httplib.FORBIDDEN) | ||
266 | 32 | |||
267 | 33 | |||
268 | 34 | class NameAlreadyTaken(Exception): | ||
269 | 35 | """The name given for a person is already in use by other person.""" | ||
270 | 36 | webservice_error(httplib.CONFLICT) | ||
271 | 37 | |||
272 | 38 | |||
273 | 39 | class NoSuchDistroSeries(NameLookupFailed): | ||
274 | 40 | """Raised when we try to find a DistroSeries that doesn't exist.""" | ||
275 | 41 | webservice_error(httplib.BAD_REQUEST) | ||
276 | 42 | _message_prefix = "No such distribution series" | ||
277 | 43 | |||
278 | 44 | |||
279 | 45 | class UserCannotChangeMembershipSilently(Unauthorized): | ||
280 | 46 | """User not permitted to change membership status silently. | ||
281 | 47 | |||
282 | 48 | Raised when a user tries to change someone's membership silently, and is | ||
283 | 49 | not a Launchpad Administrator. | ||
284 | 50 | """ | ||
285 | 51 | webservice_error(httplib.UNAUTHORIZED) | ||
286 | 52 | |||
287 | 53 | |||
288 | 54 | class NoSuchSourcePackageName(NameLookupFailed): | ||
289 | 55 | """Raised when we can't find a particular sourcepackagename.""" | ||
290 | 56 | webservice_error(httplib.BAD_REQUEST) | ||
291 | 57 | _message_prefix = "No such source package" | ||
292 | 58 | |||
293 | 59 | |||
294 | 60 | class CannotTransitionToCountryMirror(Exception): | ||
295 | 61 | """Root exception for transitions to country mirrors.""" | ||
296 | 62 | webservice_error(httplib.BAD_REQUEST) | ||
297 | 63 | |||
298 | 64 | |||
299 | 65 | class CountryMirrorAlreadySet(CannotTransitionToCountryMirror): | ||
300 | 66 | """Distribution mirror cannot be set as a country mirror. | ||
301 | 67 | |||
302 | 68 | Raised when a user tries to change set a distribution mirror as a country | ||
303 | 69 | mirror, however there is already one set for that country. | ||
304 | 70 | """ | ||
305 | 71 | |||
306 | 72 | |||
307 | 73 | class MirrorNotOfficial(CannotTransitionToCountryMirror): | ||
308 | 74 | """Distribution mirror is not permitted to become a country mirror. | ||
309 | 75 | |||
310 | 76 | Raised when a user tries to change set a distribution mirror as a country | ||
311 | 77 | mirror, however the mirror in question is not official. | ||
312 | 78 | """ | ||
313 | 79 | |||
314 | 80 | |||
315 | 81 | class MirrorHasNoHTTPURL(CannotTransitionToCountryMirror): | ||
316 | 82 | """Distribution mirror has no HTTP URL. | ||
317 | 83 | |||
318 | 84 | Raised when a user tries to make an official mirror a country mirror, | ||
319 | 85 | however the mirror has not HTTP URL set. | ||
320 | 86 | """ | ||
321 | 87 | |||
322 | 88 | |||
323 | 89 | class MirrorNotProbed(CannotTransitionToCountryMirror): | ||
324 | 90 | """Distribution mirror has not been probed. | ||
325 | 91 | |||
326 | 92 | Raised when a user tries to set an official mirror as a country mirror, | ||
327 | 93 | however the mirror has not been probed yet. | ||
328 | 94 | """ | ||
329 | 95 | |||
330 | 96 | |||
331 | 97 | class DeleteSubscriptionError(Exception): | ||
332 | 98 | """Delete Subscription Error. | ||
333 | 99 | |||
334 | 100 | Raised when an error occurred trying to delete a | ||
335 | 101 | structural subscription.""" | ||
336 | 102 | webservice_error(httplib.BAD_REQUEST) | ||
337 | 103 | |||
338 | 104 | |||
339 | 105 | class UserCannotSubscribePerson(Exception): | ||
340 | 106 | """User does not have permission to subscribe the person or team.""" | ||
341 | 107 | webservice_error(httplib.UNAUTHORIZED) | ||
342 | 12 | 108 | ||
343 | 13 | 109 | ||
344 | 14 | class TeamMembershipTransitionError(ValueError): | 110 | class TeamMembershipTransitionError(ValueError): |
345 | 15 | 111 | ||
346 | === modified file 'lib/lp/registry/interfaces/distributionmirror.py' | |||
347 | --- lib/lp/registry/interfaces/distributionmirror.py 2010-08-20 20:31:18 +0000 | |||
348 | +++ lib/lp/registry/interfaces/distributionmirror.py 2010-10-04 12:14:48 +0000 | |||
349 | @@ -6,8 +6,6 @@ | |||
350 | 6 | __metaclass__ = type | 6 | __metaclass__ = type |
351 | 7 | 7 | ||
352 | 8 | __all__ = [ | 8 | __all__ = [ |
353 | 9 | 'CannotTransitionToCountryMirror', | ||
354 | 10 | 'CountryMirrorAlreadySet', | ||
355 | 11 | 'IDistributionMirror', | 9 | 'IDistributionMirror', |
356 | 12 | 'IMirrorDistroArchSeries', | 10 | 'IMirrorDistroArchSeries', |
357 | 13 | 'IMirrorDistroSeriesSource', | 11 | 'IMirrorDistroSeriesSource', |
358 | @@ -16,11 +14,8 @@ | |||
359 | 16 | 'IMirrorCDImageDistroSeries', | 14 | 'IMirrorCDImageDistroSeries', |
360 | 17 | 'PROBE_INTERVAL', | 15 | 'PROBE_INTERVAL', |
361 | 18 | 'MirrorContent', | 16 | 'MirrorContent', |
362 | 17 | 'MirrorSpeed', | ||
363 | 19 | 'MirrorFreshness', | 18 | 'MirrorFreshness', |
364 | 20 | 'MirrorHasNoHTTPURL', | ||
365 | 21 | 'MirrorNotOfficial', | ||
366 | 22 | 'MirrorNotProbed', | ||
367 | 23 | 'MirrorSpeed', | ||
368 | 24 | 'MirrorStatus', | 19 | 'MirrorStatus', |
369 | 25 | 'UnableToFetchCDImageFileList', | 20 | 'UnableToFetchCDImageFileList', |
370 | 26 | ] | 21 | ] |
371 | @@ -38,7 +33,6 @@ | |||
372 | 38 | exported, | 33 | exported, |
373 | 39 | mutator_for, | 34 | mutator_for, |
374 | 40 | operation_parameters, | 35 | operation_parameters, |
375 | 41 | webservice_error, | ||
376 | 42 | ) | 36 | ) |
377 | 43 | from lazr.restful.fields import ( | 37 | from lazr.restful.fields import ( |
378 | 44 | Reference, | 38 | Reference, |
379 | @@ -76,43 +70,6 @@ | |||
380 | 76 | PROBE_INTERVAL = 23 | 70 | PROBE_INTERVAL = 23 |
381 | 77 | 71 | ||
382 | 78 | 72 | ||
383 | 79 | class CannotTransitionToCountryMirror(Exception): | ||
384 | 80 | """Root exception for transitions to country mirrors.""" | ||
385 | 81 | webservice_error(400) | ||
386 | 82 | |||
387 | 83 | |||
388 | 84 | class CountryMirrorAlreadySet(CannotTransitionToCountryMirror): | ||
389 | 85 | """Distribution mirror cannot be set as a country mirror. | ||
390 | 86 | |||
391 | 87 | Raised when a user tries to change set a distribution mirror as a country | ||
392 | 88 | mirror, however there is already one set for that country. | ||
393 | 89 | """ | ||
394 | 90 | |||
395 | 91 | |||
396 | 92 | class MirrorNotOfficial(CannotTransitionToCountryMirror): | ||
397 | 93 | """Distribution mirror is not permitted to become a country mirror. | ||
398 | 94 | |||
399 | 95 | Raised when a user tries to change set a distribution mirror as a country | ||
400 | 96 | mirror, however the mirror in question is not official. | ||
401 | 97 | """ | ||
402 | 98 | |||
403 | 99 | |||
404 | 100 | class MirrorHasNoHTTPURL(CannotTransitionToCountryMirror): | ||
405 | 101 | """Distribution mirror has no HTTP URL. | ||
406 | 102 | |||
407 | 103 | Raised when a user tries to make an official mirror a country mirror, | ||
408 | 104 | however the mirror has not HTTP URL set. | ||
409 | 105 | """ | ||
410 | 106 | |||
411 | 107 | |||
412 | 108 | class MirrorNotProbed(CannotTransitionToCountryMirror): | ||
413 | 109 | """Distribution mirror has not been probed. | ||
414 | 110 | |||
415 | 111 | Raised when a user tries to set an official mirror as a country mirror, | ||
416 | 112 | however the mirror has not been probed yet. | ||
417 | 113 | """ | ||
418 | 114 | |||
419 | 115 | |||
420 | 116 | class MirrorContent(DBEnumeratedType): | 73 | class MirrorContent(DBEnumeratedType): |
421 | 117 | """The content that is mirrored.""" | 74 | """The content that is mirrored.""" |
422 | 118 | 75 | ||
423 | @@ -191,13 +148,13 @@ | |||
424 | 191 | S2G = DBItem(90, """ | 148 | S2G = DBItem(90, """ |
425 | 192 | 2 Gbps | 149 | 2 Gbps |
426 | 193 | 150 | ||
428 | 194 | The upstream link of this mirror can make up to 2 gigabit per second. | 151 | The upstream link of this mirror can make up to 2 gigabits per second. |
429 | 195 | """) | 152 | """) |
430 | 196 | 153 | ||
431 | 197 | S4G = DBItem(100, """ | 154 | S4G = DBItem(100, """ |
432 | 198 | 4 Gbps | 155 | 4 Gbps |
433 | 199 | 156 | ||
435 | 200 | The upstream link of this mirror can make up to 4 gigabit per second. | 157 | The upstream link of this mirror can make up to 4 gigabits per second. |
436 | 201 | """) | 158 | """) |
437 | 202 | 159 | ||
438 | 203 | S10G = DBItem(110, """ | 160 | S10G = DBItem(110, """ |
439 | @@ -359,7 +316,8 @@ | |||
440 | 359 | owner = exported(PublicPersonChoice( | 316 | owner = exported(PublicPersonChoice( |
441 | 360 | title=_('Owner'), readonly=False, vocabulary='ValidOwner', | 317 | title=_('Owner'), readonly=False, vocabulary='ValidOwner', |
442 | 361 | required=True, description=_( | 318 | required=True, description=_( |
444 | 362 | "The person who is set as the current administrator of this mirror."))) | 319 | "The person who is set as the current administrator of this" |
445 | 320 | "mirror."))) | ||
446 | 363 | distribution = exported( | 321 | distribution = exported( |
447 | 364 | Reference( | 322 | Reference( |
448 | 365 | Interface, | 323 | Interface, |
449 | @@ -461,7 +419,7 @@ | |||
450 | 461 | @operation_parameters(country_dns_mirror=copy_field(country_dns_mirror)) | 419 | @operation_parameters(country_dns_mirror=copy_field(country_dns_mirror)) |
451 | 462 | @export_write_operation() | 420 | @export_write_operation() |
452 | 463 | def transitionToCountryMirror(country_dns_mirror): | 421 | def transitionToCountryMirror(country_dns_mirror): |
454 | 464 | """Method run on changing country_dns_mirror.""" | 422 | """Method run on changing country_dns_mirror.""" |
455 | 465 | 423 | ||
456 | 466 | @invariant | 424 | @invariant |
457 | 467 | def mirrorMustHaveHTTPOrFTPURL(mirror): | 425 | def mirrorMustHaveHTTPOrFTPURL(mirror): |
458 | @@ -598,7 +556,6 @@ | |||
459 | 598 | """ | 556 | """ |
460 | 599 | 557 | ||
461 | 600 | 558 | ||
462 | 601 | |||
463 | 602 | class UnableToFetchCDImageFileList(Exception): | 559 | class UnableToFetchCDImageFileList(Exception): |
464 | 603 | """Couldn't fetch the file list needed for probing cdimage mirrors.""" | 560 | """Couldn't fetch the file list needed for probing cdimage mirrors.""" |
465 | 604 | 561 | ||
466 | 605 | 562 | ||
467 | === modified file 'lib/lp/registry/interfaces/distroseries.py' | |||
468 | --- lib/lp/registry/interfaces/distroseries.py 2010-09-21 13:05:42 +0000 | |||
469 | +++ lib/lp/registry/interfaces/distroseries.py 2010-10-04 12:14:48 +0000 | |||
470 | @@ -12,7 +12,6 @@ | |||
471 | 12 | 'IDistroSeriesEditRestricted', | 12 | 'IDistroSeriesEditRestricted', |
472 | 13 | 'IDistroSeriesPublic', | 13 | 'IDistroSeriesPublic', |
473 | 14 | 'IDistroSeriesSet', | 14 | 'IDistroSeriesSet', |
474 | 15 | 'NoSuchDistroSeries', | ||
475 | 16 | ] | 15 | ] |
476 | 17 | 16 | ||
477 | 18 | from lazr.enum import DBEnumeratedType | 17 | from lazr.enum import DBEnumeratedType |
478 | @@ -26,7 +25,6 @@ | |||
479 | 26 | operation_returns_collection_of, | 25 | operation_returns_collection_of, |
480 | 27 | operation_returns_entry, | 26 | operation_returns_entry, |
481 | 28 | rename_parameters_as, | 27 | rename_parameters_as, |
482 | 29 | webservice_error, | ||
483 | 30 | ) | 28 | ) |
484 | 31 | from lazr.restful.fields import ( | 29 | from lazr.restful.fields import ( |
485 | 32 | Reference, | 30 | Reference, |
486 | @@ -51,7 +49,6 @@ | |||
487 | 51 | from canonical.launchpad.validators.email import email_validator | 49 | from canonical.launchpad.validators.email import email_validator |
488 | 52 | from canonical.launchpad.validators.name import name_validator | 50 | from canonical.launchpad.validators.name import name_validator |
489 | 53 | from canonical.launchpad.validators.version import sane_version | 51 | from canonical.launchpad.validators.version import sane_version |
490 | 54 | from lp.app.errors import NameLookupFailed | ||
491 | 55 | from lp.app.interfaces.launchpad import IServiceUsage | 52 | from lp.app.interfaces.launchpad import IServiceUsage |
492 | 56 | from lp.blueprints.interfaces.specificationtarget import ISpecificationGoal | 53 | from lp.blueprints.interfaces.specificationtarget import ISpecificationGoal |
493 | 57 | from lp.bugs.interfaces.bugtarget import ( | 54 | from lp.bugs.interfaces.bugtarget import ( |
494 | @@ -59,6 +56,7 @@ | |||
495 | 59 | IHasBugs, | 56 | IHasBugs, |
496 | 60 | IHasOfficialBugTags, | 57 | IHasOfficialBugTags, |
497 | 61 | ) | 58 | ) |
498 | 59 | from lp.registry.errors import NoSuchDistroSeries | ||
499 | 62 | from lp.registry.interfaces.milestone import ( | 60 | from lp.registry.interfaces.milestone import ( |
500 | 63 | IHasMilestones, | 61 | IHasMilestones, |
501 | 64 | IMilestone, | 62 | IMilestone, |
502 | @@ -858,11 +856,5 @@ | |||
503 | 858 | """ | 856 | """ |
504 | 859 | 857 | ||
505 | 860 | 858 | ||
506 | 861 | class NoSuchDistroSeries(NameLookupFailed): | ||
507 | 862 | """Raised when we try to find a DistroSeries that doesn't exist.""" | ||
508 | 863 | webservice_error(400) #Bad request. | ||
509 | 864 | _message_prefix = "No such distribution series" | ||
510 | 865 | |||
511 | 866 | |||
512 | 867 | # Monkey patch for circular import avoidance done in | 859 | # Monkey patch for circular import avoidance done in |
513 | 868 | # _schema_circular_imports.py | 860 | # _schema_circular_imports.py |
514 | 869 | 861 | ||
515 | === modified file 'lib/lp/registry/interfaces/person.py' | |||
516 | --- lib/lp/registry/interfaces/person.py 2010-09-24 21:10:47 +0000 | |||
517 | +++ lib/lp/registry/interfaces/person.py 2010-10-04 12:14:48 +0000 | |||
518 | @@ -27,12 +27,10 @@ | |||
519 | 27 | 'ImmutableVisibilityError', | 27 | 'ImmutableVisibilityError', |
520 | 28 | 'InvalidName', | 28 | 'InvalidName', |
521 | 29 | 'JoinNotAllowed', | 29 | 'JoinNotAllowed', |
522 | 30 | 'NameAlreadyTaken', | ||
523 | 31 | 'NoSuchPerson', | 30 | 'NoSuchPerson', |
524 | 32 | 'PersonCreationRationale', | 31 | 'PersonCreationRationale', |
525 | 33 | 'PersonVisibility', | 32 | 'PersonVisibility', |
526 | 34 | 'PersonalStanding', | 33 | 'PersonalStanding', |
527 | 35 | 'PrivatePersonLinkageError', | ||
528 | 36 | 'PRIVATE_TEAM_PREFIX', | 34 | 'PRIVATE_TEAM_PREFIX', |
529 | 37 | 'TeamContactMethod', | 35 | 'TeamContactMethod', |
530 | 38 | 'TeamMembershipRenewalPolicy', | 36 | 'TeamMembershipRenewalPolicy', |
531 | @@ -41,8 +39,6 @@ | |||
532 | 41 | 'validate_public_person', | 39 | 'validate_public_person', |
533 | 42 | ] | 40 | ] |
534 | 43 | 41 | ||
535 | 44 | import httplib | ||
536 | 45 | |||
537 | 46 | from lazr.enum import ( | 42 | from lazr.enum import ( |
538 | 47 | DBEnumeratedType, | 43 | DBEnumeratedType, |
539 | 48 | DBItem, | 44 | DBItem, |
540 | @@ -65,9 +61,7 @@ | |||
541 | 65 | operation_returns_entry, | 61 | operation_returns_entry, |
542 | 66 | rename_parameters_as, | 62 | rename_parameters_as, |
543 | 67 | REQUEST_USER, | 63 | REQUEST_USER, |
544 | 68 | webservice_error, | ||
545 | 69 | ) | 64 | ) |
546 | 70 | from lazr.restful.error import expose | ||
547 | 71 | from lazr.restful.fields import ( | 65 | from lazr.restful.fields import ( |
548 | 72 | CollectionField, | 66 | CollectionField, |
549 | 73 | Reference, | 67 | Reference, |
550 | @@ -121,6 +115,7 @@ | |||
551 | 121 | IHasRequestedReviews, | 115 | IHasRequestedReviews, |
552 | 122 | ) | 116 | ) |
553 | 123 | from lp.code.interfaces.hasrecipes import IHasRecipes | 117 | from lp.code.interfaces.hasrecipes import IHasRecipes |
554 | 118 | from lp.registry.errors import PrivatePersonLinkageError | ||
555 | 124 | from lp.registry.interfaces.gpg import IGPGKey | 119 | from lp.registry.interfaces.gpg import IGPGKey |
556 | 125 | from lp.registry.interfaces.irc import IIrcID | 120 | from lp.registry.interfaces.irc import IIrcID |
557 | 126 | from lp.registry.interfaces.jabber import IJabberID | 121 | from lp.registry.interfaces.jabber import IJabberID |
558 | @@ -158,14 +153,6 @@ | |||
559 | 158 | PRIVATE_TEAM_PREFIX = 'private-' | 153 | PRIVATE_TEAM_PREFIX = 'private-' |
560 | 159 | 154 | ||
561 | 160 | 155 | ||
562 | 161 | class PrivatePersonLinkageError(ValueError): | ||
563 | 162 | """An attempt was made to link a private person/team to something.""" | ||
564 | 163 | # HTTP 400 -- BAD REQUEST | ||
565 | 164 | # HTTP 403 would be better, but as this excpetion is raised inside a | ||
566 | 165 | # validator, it will default to 400 anyway. | ||
567 | 166 | webservice_error(httplib.BAD_REQUEST) | ||
568 | 167 | |||
569 | 168 | |||
570 | 169 | @block_implicit_flushes | 156 | @block_implicit_flushes |
571 | 170 | def validate_person_common(obj, attr, value, validate_func): | 157 | def validate_person_common(obj, attr, value, validate_func): |
572 | 171 | """Validate the person using the supplied function.""" | 158 | """Validate the person using the supplied function.""" |
573 | @@ -178,10 +165,10 @@ | |||
574 | 178 | from lp.registry.model.person import Person | 165 | from lp.registry.model.person import Person |
575 | 179 | person = Person.get(value) | 166 | person = Person.get(value) |
576 | 180 | if not validate_func(person): | 167 | if not validate_func(person): |
578 | 181 | raise expose(PrivatePersonLinkageError( | 168 | raise PrivatePersonLinkageError( |
579 | 182 | "Cannot link person (name=%s, visibility=%s) to %s (name=%s)" | 169 | "Cannot link person (name=%s, visibility=%s) to %s (name=%s)" |
580 | 183 | % (person.name, person.visibility.name, | 170 | % (person.name, person.visibility.name, |
582 | 184 | obj, getattr(obj, 'name', None)))) | 171 | obj, getattr(obj, 'name', None))) |
583 | 185 | return value | 172 | return value |
584 | 186 | 173 | ||
585 | 187 | 174 | ||
586 | @@ -2182,11 +2169,6 @@ | |||
587 | 2182 | """The name given for a person is not valid.""" | 2169 | """The name given for a person is not valid.""" |
588 | 2183 | 2170 | ||
589 | 2184 | 2171 | ||
590 | 2185 | class NameAlreadyTaken(Exception): | ||
591 | 2186 | """The name given for a person is already in use by other person.""" | ||
592 | 2187 | webservice_error(409) | ||
593 | 2188 | |||
594 | 2189 | |||
595 | 2190 | class NoSuchPerson(NameLookupFailed): | 2172 | class NoSuchPerson(NameLookupFailed): |
596 | 2191 | """Raised when we try to look up an IPerson that doesn't exist.""" | 2173 | """Raised when we try to look up an IPerson that doesn't exist.""" |
597 | 2192 | 2174 | ||
598 | 2193 | 2175 | ||
599 | === modified file 'lib/lp/registry/interfaces/sourcepackagename.py' | |||
600 | --- lib/lp/registry/interfaces/sourcepackagename.py 2010-08-20 20:31:18 +0000 | |||
601 | +++ lib/lp/registry/interfaces/sourcepackagename.py 2010-10-04 12:14:48 +0000 | |||
602 | @@ -10,10 +10,8 @@ | |||
603 | 10 | __all__ = [ | 10 | __all__ = [ |
604 | 11 | 'ISourcePackageName', | 11 | 'ISourcePackageName', |
605 | 12 | 'ISourcePackageNameSet', | 12 | 'ISourcePackageNameSet', |
606 | 13 | 'NoSuchSourcePackageName', | ||
607 | 14 | ] | 13 | ] |
608 | 15 | 14 | ||
609 | 16 | from lazr.restful.declarations import webservice_error | ||
610 | 17 | from zope.interface import ( | 15 | from zope.interface import ( |
611 | 18 | Attribute, | 16 | Attribute, |
612 | 19 | Interface, | 17 | Interface, |
613 | @@ -25,7 +23,6 @@ | |||
614 | 25 | 23 | ||
615 | 26 | from canonical.launchpad import _ | 24 | from canonical.launchpad import _ |
616 | 27 | from canonical.launchpad.validators.name import name_validator | 25 | from canonical.launchpad.validators.name import name_validator |
617 | 28 | from lp.app.errors import NameLookupFailed | ||
618 | 29 | 26 | ||
619 | 30 | 27 | ||
620 | 31 | class ISourcePackageName(Interface): | 28 | class ISourcePackageName(Interface): |
621 | @@ -54,7 +51,8 @@ | |||
622 | 54 | def get(sourcepackagenameid): | 51 | def get(sourcepackagenameid): |
623 | 55 | """Return a sourcepackagename by its id. | 52 | """Return a sourcepackagename by its id. |
624 | 56 | 53 | ||
626 | 57 | If the sourcepackagename can't be found a NotFoundError will be raised. | 54 | If the sourcepackagename can't be found a NotFoundError will be |
627 | 55 | raised. | ||
628 | 58 | """ | 56 | """ |
629 | 59 | 57 | ||
630 | 60 | def getAll(): | 58 | def getAll(): |
631 | @@ -74,9 +72,3 @@ | |||
632 | 74 | 72 | ||
633 | 75 | def getOrCreateByName(name): | 73 | def getOrCreateByName(name): |
634 | 76 | """Get a source package name by name, creating it if necessary.""" | 74 | """Get a source package name by name, creating it if necessary.""" |
635 | 77 | |||
636 | 78 | |||
637 | 79 | class NoSuchSourcePackageName(NameLookupFailed): | ||
638 | 80 | """Raised when we can't find a particular sourcepackagename.""" | ||
639 | 81 | webservice_error(400) | ||
640 | 82 | _message_prefix = "No such source package" | ||
641 | 83 | 75 | ||
642 | === modified file 'lib/lp/registry/interfaces/structuralsubscription.py' | |||
643 | --- lib/lp/registry/interfaces/structuralsubscription.py 2010-08-20 20:31:18 +0000 | |||
644 | +++ lib/lp/registry/interfaces/structuralsubscription.py 2010-10-04 12:14:48 +0000 | |||
645 | @@ -10,11 +10,9 @@ | |||
646 | 10 | __all__ = [ | 10 | __all__ = [ |
647 | 11 | 'BlueprintNotificationLevel', | 11 | 'BlueprintNotificationLevel', |
648 | 12 | 'BugNotificationLevel', | 12 | 'BugNotificationLevel', |
649 | 13 | 'DeleteSubscriptionError', | ||
650 | 14 | 'IStructuralSubscription', | 13 | 'IStructuralSubscription', |
651 | 15 | 'IStructuralSubscriptionForm', | 14 | 'IStructuralSubscriptionForm', |
652 | 16 | 'IStructuralSubscriptionTarget', | 15 | 'IStructuralSubscriptionTarget', |
653 | 17 | 'UserCannotSubscribePerson', | ||
654 | 18 | ] | 16 | ] |
655 | 19 | 17 | ||
656 | 20 | from lazr.enum import ( | 18 | from lazr.enum import ( |
657 | @@ -32,7 +30,6 @@ | |||
658 | 32 | operation_returns_collection_of, | 30 | operation_returns_collection_of, |
659 | 33 | operation_returns_entry, | 31 | operation_returns_entry, |
660 | 34 | REQUEST_USER, | 32 | REQUEST_USER, |
661 | 35 | webservice_error, | ||
662 | 36 | ) | 33 | ) |
663 | 37 | from lazr.restful.fields import Reference | 34 | from lazr.restful.fields import Reference |
664 | 38 | from zope.interface import ( | 35 | from zope.interface import ( |
665 | @@ -247,16 +244,3 @@ | |||
666 | 247 | subscribe_me = Bool( | 244 | subscribe_me = Bool( |
667 | 248 | title=u"I want to receive these notifications by e-mail.", | 245 | title=u"I want to receive these notifications by e-mail.", |
668 | 249 | required=False) | 246 | required=False) |
669 | 250 | |||
670 | 251 | |||
671 | 252 | class DeleteSubscriptionError(Exception): | ||
672 | 253 | """Delete Subscription Error. | ||
673 | 254 | |||
674 | 255 | Raised when an error occurred trying to delete a | ||
675 | 256 | structural subscription.""" | ||
676 | 257 | webservice_error(400) | ||
677 | 258 | |||
678 | 259 | |||
679 | 260 | class UserCannotSubscribePerson(Exception): | ||
680 | 261 | """User does not have permission to subscribe the person or team.""" | ||
681 | 262 | webservice_error(401) | ||
682 | 263 | 247 | ||
683 | === modified file 'lib/lp/registry/interfaces/teammembership.py' | |||
684 | --- lib/lp/registry/interfaces/teammembership.py 2010-09-01 19:46:27 +0000 | |||
685 | +++ lib/lp/registry/interfaces/teammembership.py 2010-10-04 12:14:48 +0000 | |||
686 | @@ -14,7 +14,6 @@ | |||
687 | 14 | 'ITeamMembershipSet', | 14 | 'ITeamMembershipSet', |
688 | 15 | 'ITeamParticipation', | 15 | 'ITeamParticipation', |
689 | 16 | 'TeamMembershipStatus', | 16 | 'TeamMembershipStatus', |
690 | 17 | 'UserCannotChangeMembershipSilently', | ||
691 | 18 | ] | 17 | ] |
692 | 19 | 18 | ||
693 | 20 | from lazr.enum import ( | 19 | from lazr.enum import ( |
694 | @@ -28,7 +27,6 @@ | |||
695 | 28 | exported, | 27 | exported, |
696 | 29 | operation_parameters, | 28 | operation_parameters, |
697 | 30 | REQUEST_USER, | 29 | REQUEST_USER, |
698 | 31 | webservice_error, | ||
699 | 32 | ) | 30 | ) |
700 | 33 | from lazr.restful.fields import Reference | 31 | from lazr.restful.fields import Reference |
701 | 34 | from lazr.restful.interface import copy_field | 32 | from lazr.restful.interface import copy_field |
702 | @@ -43,7 +41,6 @@ | |||
703 | 43 | Int, | 41 | Int, |
704 | 44 | Text, | 42 | Text, |
705 | 45 | ) | 43 | ) |
706 | 46 | from zope.security.interfaces import Unauthorized | ||
707 | 47 | 44 | ||
708 | 48 | from canonical.launchpad import _ | 45 | from canonical.launchpad import _ |
709 | 49 | 46 | ||
710 | @@ -53,15 +50,6 @@ | |||
711 | 53 | DAYS_BEFORE_EXPIRATION_WARNING_IS_SENT = 7 | 50 | DAYS_BEFORE_EXPIRATION_WARNING_IS_SENT = 7 |
712 | 54 | 51 | ||
713 | 55 | 52 | ||
714 | 56 | class UserCannotChangeMembershipSilently(Unauthorized): | ||
715 | 57 | """User not permitted to change membership status silently. | ||
716 | 58 | |||
717 | 59 | Raised when a user tries to change someone's membership silently, and is | ||
718 | 60 | not a Launchpad Administrator. | ||
719 | 61 | """ | ||
720 | 62 | webservice_error(401) # HTTP Error: 'Unauthorized' | ||
721 | 63 | |||
722 | 64 | |||
723 | 65 | class TeamMembershipStatus(DBEnumeratedType): | 53 | class TeamMembershipStatus(DBEnumeratedType): |
724 | 66 | """TeamMembership Status | 54 | """TeamMembership Status |
725 | 67 | 55 | ||
726 | 68 | 56 | ||
727 | === modified file 'lib/lp/registry/model/distribution.py' | |||
728 | --- lib/lp/registry/model/distribution.py 2010-09-03 03:12:39 +0000 | |||
729 | +++ lib/lp/registry/model/distribution.py 2010-10-04 12:14:48 +0000 | |||
730 | @@ -88,7 +88,6 @@ | |||
731 | 88 | SpecificationDefinitionStatus, | 88 | SpecificationDefinitionStatus, |
732 | 89 | SpecificationFilter, | 89 | SpecificationFilter, |
733 | 90 | SpecificationImplementationStatus, | 90 | SpecificationImplementationStatus, |
734 | 91 | SpecificationSort, | ||
735 | 92 | ) | 91 | ) |
736 | 93 | from lp.blueprints.model.specification import ( | 92 | from lp.blueprints.model.specification import ( |
737 | 94 | HasSpecificationsMixin, | 93 | HasSpecificationsMixin, |
738 | @@ -112,6 +111,7 @@ | |||
739 | 112 | OfficialBugTagTargetMixin, | 111 | OfficialBugTagTargetMixin, |
740 | 113 | ) | 112 | ) |
741 | 114 | from lp.bugs.model.bugtask import BugTask | 113 | from lp.bugs.model.bugtask import BugTask |
742 | 114 | from lp.registry.errors import NoSuchDistroSeries | ||
743 | 115 | from lp.registry.interfaces.distribution import ( | 115 | from lp.registry.interfaces.distribution import ( |
744 | 116 | IBaseDistribution, | 116 | IBaseDistribution, |
745 | 117 | IDerivativeDistribution, | 117 | IDerivativeDistribution, |
746 | @@ -123,7 +123,6 @@ | |||
747 | 123 | MirrorContent, | 123 | MirrorContent, |
748 | 124 | MirrorStatus, | 124 | MirrorStatus, |
749 | 125 | ) | 125 | ) |
750 | 126 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | ||
751 | 127 | from lp.registry.interfaces.packaging import PackagingType | 126 | from lp.registry.interfaces.packaging import PackagingType |
752 | 128 | from lp.registry.interfaces.person import ( | 127 | from lp.registry.interfaces.person import ( |
753 | 129 | validate_person, | 128 | validate_person, |
754 | 130 | 129 | ||
755 | === modified file 'lib/lp/registry/model/distributionmirror.py' | |||
756 | --- lib/lp/registry/model/distributionmirror.py 2010-08-24 15:29:01 +0000 | |||
757 | +++ lib/lp/registry/model/distributionmirror.py 2010-10-04 12:14:48 +0000 | |||
758 | @@ -56,9 +56,14 @@ | |||
759 | 56 | MAIN_STORE, | 56 | MAIN_STORE, |
760 | 57 | ) | 57 | ) |
761 | 58 | from lp.archivepublisher.diskpool import poolify | 58 | from lp.archivepublisher.diskpool import poolify |
763 | 59 | from lp.registry.interfaces.distributionmirror import ( | 59 | from lp.registry.errors import ( |
764 | 60 | CannotTransitionToCountryMirror, | 60 | CannotTransitionToCountryMirror, |
765 | 61 | CountryMirrorAlreadySet, | 61 | CountryMirrorAlreadySet, |
766 | 62 | MirrorHasNoHTTPURL, | ||
767 | 63 | MirrorNotOfficial, | ||
768 | 64 | MirrorNotProbed, | ||
769 | 65 | ) | ||
770 | 66 | from lp.registry.interfaces.distributionmirror import ( | ||
771 | 62 | IDistributionMirror, | 67 | IDistributionMirror, |
772 | 63 | IDistributionMirrorSet, | 68 | IDistributionMirrorSet, |
773 | 64 | IMirrorCDImageDistroSeries, | 69 | IMirrorCDImageDistroSeries, |
774 | @@ -67,9 +72,6 @@ | |||
775 | 67 | IMirrorProbeRecord, | 72 | IMirrorProbeRecord, |
776 | 68 | MirrorContent, | 73 | MirrorContent, |
777 | 69 | MirrorFreshness, | 74 | MirrorFreshness, |
778 | 70 | MirrorHasNoHTTPURL, | ||
779 | 71 | MirrorNotOfficial, | ||
780 | 72 | MirrorNotProbed, | ||
781 | 73 | MirrorSpeed, | 75 | MirrorSpeed, |
782 | 74 | MirrorStatus, | 76 | MirrorStatus, |
783 | 75 | PROBE_INTERVAL, | 77 | PROBE_INTERVAL, |
784 | @@ -353,7 +355,8 @@ | |||
785 | 353 | if mirror is not None: | 355 | if mirror is not None: |
786 | 354 | mirror.destroySelf() | 356 | mirror.destroySelf() |
787 | 355 | 357 | ||
789 | 356 | def _getMirrorDistroArchSeries(self, distro_arch_series, pocket, component): | 358 | def _getMirrorDistroArchSeries( |
790 | 359 | self, distro_arch_series, pocket, component): | ||
791 | 357 | """Return MirrorDistroArchSeries given a arch series and pocket.""" | 360 | """Return MirrorDistroArchSeries given a arch series and pocket.""" |
792 | 358 | 361 | ||
793 | 359 | return IStore(MirrorDistroArchSeries).find( | 362 | return IStore(MirrorDistroArchSeries).find( |
794 | @@ -525,7 +528,7 @@ | |||
795 | 525 | class DistributionMirrorSet: | 528 | class DistributionMirrorSet: |
796 | 526 | """See IDistributionMirrorSet""" | 529 | """See IDistributionMirrorSet""" |
797 | 527 | 530 | ||
799 | 528 | implements (IDistributionMirrorSet) | 531 | implements(IDistributionMirrorSet) |
800 | 529 | 532 | ||
801 | 530 | def __getitem__(self, mirror_id): | 533 | def __getitem__(self, mirror_id): |
802 | 531 | """See IDistributionMirrorSet""" | 534 | """See IDistributionMirrorSet""" |
803 | @@ -652,7 +655,7 @@ | |||
804 | 652 | (MirrorFreshness.SIXHOURSBEHIND, 6.5), | 655 | (MirrorFreshness.SIXHOURSBEHIND, 6.5), |
805 | 653 | (MirrorFreshness.ONEDAYBEHIND, 24.5), | 656 | (MirrorFreshness.ONEDAYBEHIND, 24.5), |
806 | 654 | (MirrorFreshness.TWODAYSBEHIND, 48.5), | 657 | (MirrorFreshness.TWODAYSBEHIND, 48.5), |
808 | 655 | (MirrorFreshness.ONEWEEKBEHIND, 168.5) | 658 | (MirrorFreshness.ONEWEEKBEHIND, 168.5), |
809 | 656 | ] | 659 | ] |
810 | 657 | 660 | ||
811 | 658 | def _getPackageReleaseURLFromPublishingRecord(self, publishing_record): | 661 | def _getPackageReleaseURLFromPublishingRecord(self, publishing_record): |
812 | @@ -799,7 +802,6 @@ | |||
813 | 799 | query, clauseTables=['BinaryPackageFile'], | 802 | query, clauseTables=['BinaryPackageFile'], |
814 | 800 | orderBy='-datepublished') | 803 | orderBy='-datepublished') |
815 | 801 | 804 | ||
816 | 802 | |||
817 | 803 | def _getPackageReleaseURLFromPublishingRecord(self, publishing_record): | 805 | def _getPackageReleaseURLFromPublishingRecord(self, publishing_record): |
818 | 804 | """Given a BinaryPackagePublishingHistory, return the URL on | 806 | """Given a BinaryPackagePublishingHistory, return the URL on |
819 | 805 | this mirror from where the BinaryPackageRelease file can be downloaded. | 807 | this mirror from where the BinaryPackageRelease file can be downloaded. |
820 | @@ -880,4 +882,3 @@ | |||
821 | 880 | log_file = ForeignKey( | 882 | log_file = ForeignKey( |
822 | 881 | dbName='log_file', foreignKey='LibraryFileAlias', notNull=True) | 883 | dbName='log_file', foreignKey='LibraryFileAlias', notNull=True) |
823 | 882 | date_created = UtcDateTimeCol(notNull=True, default=UTC_NOW) | 884 | date_created = UtcDateTimeCol(notNull=True, default=UTC_NOW) |
824 | 883 | |||
825 | 884 | 885 | ||
826 | === modified file 'lib/lp/registry/model/person.py' | |||
827 | --- lib/lp/registry/model/person.py 2010-09-21 02:47:03 +0000 | |||
828 | +++ lib/lp/registry/model/person.py 2010-10-04 12:14:48 +0000 | |||
829 | @@ -191,6 +191,7 @@ | |||
830 | 191 | HasMergeProposalsMixin, | 191 | HasMergeProposalsMixin, |
831 | 192 | HasRequestedReviewsMixin, | 192 | HasRequestedReviewsMixin, |
832 | 193 | ) | 193 | ) |
833 | 194 | from lp.registry.errors import NameAlreadyTaken | ||
834 | 194 | from lp.registry.interfaces.codeofconduct import ISignedCodeOfConductSet | 195 | from lp.registry.interfaces.codeofconduct import ISignedCodeOfConductSet |
835 | 195 | from lp.registry.interfaces.distribution import IDistribution | 196 | from lp.registry.interfaces.distribution import IDistribution |
836 | 196 | from lp.registry.interfaces.gpg import IGPGKeySet | 197 | from lp.registry.interfaces.gpg import IGPGKeySet |
837 | @@ -217,7 +218,6 @@ | |||
838 | 217 | IPersonSet, | 218 | IPersonSet, |
839 | 218 | ITeam, | 219 | ITeam, |
840 | 219 | JoinNotAllowed, | 220 | JoinNotAllowed, |
841 | 220 | NameAlreadyTaken, | ||
842 | 221 | PersonalStanding, | 221 | PersonalStanding, |
843 | 222 | PersonCreationRationale, | 222 | PersonCreationRationale, |
844 | 223 | PersonVisibility, | 223 | PersonVisibility, |
845 | @@ -1256,7 +1256,7 @@ | |||
846 | 1256 | try: | 1256 | try: |
847 | 1257 | return self._inTeam_cache[team.id] | 1257 | return self._inTeam_cache[team.id] |
848 | 1258 | except KeyError: | 1258 | except KeyError: |
850 | 1259 | pass | 1259 | pass |
851 | 1260 | 1260 | ||
852 | 1261 | tp = TeamParticipation.selectOneBy(team=team, person=self) | 1261 | tp = TeamParticipation.selectOneBy(team=team, person=self) |
853 | 1262 | if tp is not None or self.id == team.teamownerID: | 1262 | if tp is not None or self.id == team.teamownerID: |
854 | 1263 | 1263 | ||
855 | === modified file 'lib/lp/registry/model/sourcepackagename.py' | |||
856 | --- lib/lp/registry/model/sourcepackagename.py 2010-08-20 20:31:18 +0000 | |||
857 | +++ lib/lp/registry/model/sourcepackagename.py 2010-10-04 12:14:48 +0000 | |||
858 | @@ -7,8 +7,8 @@ | |||
859 | 7 | __all__ = [ | 7 | __all__ = [ |
860 | 8 | 'SourcePackageName', | 8 | 'SourcePackageName', |
861 | 9 | 'SourcePackageNameSet', | 9 | 'SourcePackageNameSet', |
864 | 10 | 'getSourcePackageDescriptions' | 10 | 'getSourcePackageDescriptions', |
865 | 11 | ] | 11 | ] |
866 | 12 | 12 | ||
867 | 13 | from sqlobject import ( | 13 | from sqlobject import ( |
868 | 14 | SQLMultipleJoin, | 14 | SQLMultipleJoin, |
869 | @@ -24,10 +24,10 @@ | |||
870 | 24 | sqlvalues, | 24 | sqlvalues, |
871 | 25 | ) | 25 | ) |
872 | 26 | from lp.app.errors import NotFoundError | 26 | from lp.app.errors import NotFoundError |
873 | 27 | from lp.registry.errors import NoSuchSourcePackageName | ||
874 | 27 | from lp.registry.interfaces.sourcepackagename import ( | 28 | from lp.registry.interfaces.sourcepackagename import ( |
875 | 28 | ISourcePackageName, | 29 | ISourcePackageName, |
876 | 29 | ISourcePackageNameSet, | 30 | ISourcePackageNameSet, |
877 | 30 | NoSuchSourcePackageName, | ||
878 | 31 | ) | 31 | ) |
879 | 32 | 32 | ||
880 | 33 | 33 | ||
881 | @@ -155,4 +155,3 @@ | |||
882 | 155 | description = ", %s" % binarypackagename | 155 | description = ", %s" % binarypackagename |
883 | 156 | descriptions[sourcepackagename] += description | 156 | descriptions[sourcepackagename] += description |
884 | 157 | return descriptions | 157 | return descriptions |
885 | 158 | |||
886 | 159 | 158 | ||
887 | === modified file 'lib/lp/registry/model/structuralsubscription.py' | |||
888 | --- lib/lp/registry/model/structuralsubscription.py 2010-08-20 20:31:18 +0000 | |||
889 | +++ lib/lp/registry/model/structuralsubscription.py 2010-10-04 12:14:48 +0000 | |||
890 | @@ -18,6 +18,10 @@ | |||
891 | 18 | ) | 18 | ) |
892 | 19 | from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities | 19 | from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities |
893 | 20 | from lp.registry.enum import BugNotificationLevel | 20 | from lp.registry.enum import BugNotificationLevel |
894 | 21 | from lp.registry.errors import ( | ||
895 | 22 | DeleteSubscriptionError, | ||
896 | 23 | UserCannotSubscribePerson, | ||
897 | 24 | ) | ||
898 | 21 | from lp.registry.interfaces.distribution import IDistribution | 25 | from lp.registry.interfaces.distribution import IDistribution |
899 | 22 | from lp.registry.interfaces.distributionsourcepackage import ( | 26 | from lp.registry.interfaces.distributionsourcepackage import ( |
900 | 23 | IDistributionSourcePackage, | 27 | IDistributionSourcePackage, |
901 | @@ -33,10 +37,8 @@ | |||
902 | 33 | from lp.registry.interfaces.projectgroup import IProjectGroup | 37 | from lp.registry.interfaces.projectgroup import IProjectGroup |
903 | 34 | from lp.registry.interfaces.structuralsubscription import ( | 38 | from lp.registry.interfaces.structuralsubscription import ( |
904 | 35 | BlueprintNotificationLevel, | 39 | BlueprintNotificationLevel, |
905 | 36 | DeleteSubscriptionError, | ||
906 | 37 | IStructuralSubscription, | 40 | IStructuralSubscription, |
907 | 38 | IStructuralSubscriptionTarget, | 41 | IStructuralSubscriptionTarget, |
908 | 39 | UserCannotSubscribePerson, | ||
909 | 40 | ) | 42 | ) |
910 | 41 | 43 | ||
911 | 42 | 44 | ||
912 | 43 | 45 | ||
913 | === modified file 'lib/lp/registry/model/teammembership.py' | |||
914 | --- lib/lp/registry/model/teammembership.py 2010-09-29 00:26:02 +0000 | |||
915 | +++ lib/lp/registry/model/teammembership.py 2010-10-04 12:14:48 +0000 | |||
916 | @@ -46,7 +46,10 @@ | |||
917 | 46 | from canonical.launchpad.mailnotification import MailWrapper | 46 | from canonical.launchpad.mailnotification import MailWrapper |
918 | 47 | from canonical.launchpad.webapp import canonical_url | 47 | from canonical.launchpad.webapp import canonical_url |
919 | 48 | from lp.app.browser.tales import DurationFormatterAPI | 48 | from lp.app.browser.tales import DurationFormatterAPI |
921 | 49 | from lp.registry.errors import TeamMembershipTransitionError | 49 | from lp.registry.errors import ( |
922 | 50 | TeamMembershipTransitionError, | ||
923 | 51 | UserCannotChangeMembershipSilently, | ||
924 | 52 | ) | ||
925 | 50 | from lp.registry.interfaces.person import ( | 53 | from lp.registry.interfaces.person import ( |
926 | 51 | IPersonSet, | 54 | IPersonSet, |
927 | 52 | TeamMembershipRenewalPolicy, | 55 | TeamMembershipRenewalPolicy, |
928 | @@ -59,7 +62,6 @@ | |||
929 | 59 | ITeamMembershipSet, | 62 | ITeamMembershipSet, |
930 | 60 | ITeamParticipation, | 63 | ITeamParticipation, |
931 | 61 | TeamMembershipStatus, | 64 | TeamMembershipStatus, |
932 | 62 | UserCannotChangeMembershipSilently, | ||
933 | 63 | ) | 65 | ) |
934 | 64 | 66 | ||
935 | 65 | 67 | ||
936 | 66 | 68 | ||
937 | === modified file 'lib/lp/registry/tests/test_distribution.py' | |||
938 | --- lib/lp/registry/tests/test_distribution.py 2010-08-23 08:46:04 +0000 | |||
939 | +++ lib/lp/registry/tests/test_distribution.py 2010-10-04 12:14:48 +0000 | |||
940 | @@ -12,8 +12,8 @@ | |||
941 | 12 | DatabaseFunctionalLayer, | 12 | DatabaseFunctionalLayer, |
942 | 13 | LaunchpadFunctionalLayer, | 13 | LaunchpadFunctionalLayer, |
943 | 14 | ) | 14 | ) |
944 | 15 | from lp.registry.errors import NoSuchDistroSeries | ||
945 | 15 | from lp.registry.interfaces.distribution import IDistribution | 16 | from lp.registry.interfaces.distribution import IDistribution |
946 | 16 | from lp.registry.interfaces.distroseries import NoSuchDistroSeries | ||
947 | 17 | from lp.registry.interfaces.series import SeriesStatus | 17 | from lp.registry.interfaces.series import SeriesStatus |
948 | 18 | from lp.registry.tests.test_distroseries import ( | 18 | from lp.registry.tests.test_distroseries import ( |
949 | 19 | TestDistroSeriesCurrentSourceReleases, | 19 | TestDistroSeriesCurrentSourceReleases, |
950 | 20 | 20 | ||
951 | === modified file 'lib/lp/registry/tests/test_distroseries.py' | |||
952 | --- lib/lp/registry/tests/test_distroseries.py 2010-08-24 15:29:01 +0000 | |||
953 | +++ lib/lp/registry/tests/test_distroseries.py 2010-10-04 12:14:48 +0000 | |||
954 | @@ -19,25 +19,19 @@ | |||
955 | 19 | DatabaseFunctionalLayer, | 19 | DatabaseFunctionalLayer, |
956 | 20 | LaunchpadFunctionalLayer, | 20 | LaunchpadFunctionalLayer, |
957 | 21 | ) | 21 | ) |
962 | 22 | from lp.registry.interfaces.distroseries import ( | 22 | from lp.registry.errors import NoSuchDistroSeries |
963 | 23 | IDistroSeriesSet, | 23 | from lp.registry.interfaces.distroseries import IDistroSeriesSet |
960 | 24 | NoSuchDistroSeries, | ||
961 | 25 | ) | ||
964 | 26 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 24 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
965 | 27 | from lp.soyuz.enums import ( | 25 | from lp.soyuz.enums import ( |
966 | 28 | ArchivePurpose, | 26 | ArchivePurpose, |
967 | 29 | PackagePublishingStatus, | 27 | PackagePublishingStatus, |
968 | 30 | ) | 28 | ) |
972 | 31 | from lp.soyuz.interfaces.archive import ( | 29 | from lp.soyuz.interfaces.archive import IArchiveSet |
970 | 32 | IArchiveSet, | ||
971 | 33 | ) | ||
973 | 34 | from lp.soyuz.interfaces.component import IComponentSet | 30 | from lp.soyuz.interfaces.component import IComponentSet |
974 | 35 | from lp.soyuz.interfaces.distroseriessourcepackagerelease import ( | 31 | from lp.soyuz.interfaces.distroseriessourcepackagerelease import ( |
975 | 36 | IDistroSeriesSourcePackageRelease, | 32 | IDistroSeriesSourcePackageRelease, |
976 | 37 | ) | 33 | ) |
980 | 38 | from lp.soyuz.interfaces.publishing import ( | 34 | from lp.soyuz.interfaces.publishing import active_publishing_status |
978 | 39 | active_publishing_status, | ||
979 | 40 | ) | ||
981 | 41 | from lp.soyuz.model.processor import ProcessorFamilySet | 35 | from lp.soyuz.model.processor import ProcessorFamilySet |
982 | 42 | from lp.soyuz.tests.test_publishing import SoyuzTestPublisher | 36 | from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
983 | 43 | from lp.testing import ( | 37 | from lp.testing import ( |
984 | 44 | 38 | ||
985 | === modified file 'lib/lp/registry/tests/test_person.py' | |||
986 | --- lib/lp/registry/tests/test_person.py 2010-09-28 03:01:37 +0000 | |||
987 | +++ lib/lp/registry/tests/test_person.py 2010-10-04 12:14:48 +0000 | |||
988 | @@ -9,9 +9,9 @@ | |||
989 | 9 | 9 | ||
990 | 10 | from lazr.lifecycle.snapshot import Snapshot | 10 | from lazr.lifecycle.snapshot import Snapshot |
991 | 11 | import pytz | 11 | import pytz |
992 | 12 | from storm.store import Store | ||
993 | 12 | from testtools.matchers import LessThan | 13 | from testtools.matchers import LessThan |
994 | 13 | import transaction | 14 | import transaction |
995 | 14 | from storm.store import Store | ||
996 | 15 | from zope.component import getUtility | 15 | from zope.component import getUtility |
997 | 16 | from zope.interface import providedBy | 16 | from zope.interface import providedBy |
998 | 17 | from zope.security.proxy import removeSecurityProxy | 17 | from zope.security.proxy import removeSecurityProxy |
999 | @@ -43,15 +43,17 @@ | |||
1000 | 43 | from lp.bugs.interfaces.bugtask import IllegalRelatedBugTasksParams | 43 | from lp.bugs.interfaces.bugtask import IllegalRelatedBugTasksParams |
1001 | 44 | from lp.bugs.model.bug import Bug | 44 | from lp.bugs.model.bug import Bug |
1002 | 45 | from lp.bugs.model.bugtask import get_related_bugtasks_search_params | 45 | from lp.bugs.model.bugtask import get_related_bugtasks_search_params |
1003 | 46 | from lp.registry.errors import ( | ||
1004 | 47 | NameAlreadyTaken, | ||
1005 | 48 | PrivatePersonLinkageError, | ||
1006 | 49 | ) | ||
1007 | 46 | from lp.registry.interfaces.karma import IKarmaCacheManager | 50 | from lp.registry.interfaces.karma import IKarmaCacheManager |
1008 | 47 | from lp.registry.interfaces.person import ( | 51 | from lp.registry.interfaces.person import ( |
1009 | 48 | ImmutableVisibilityError, | 52 | ImmutableVisibilityError, |
1010 | 49 | InvalidName, | 53 | InvalidName, |
1011 | 50 | IPersonSet, | 54 | IPersonSet, |
1012 | 51 | NameAlreadyTaken, | ||
1013 | 52 | PersonCreationRationale, | 55 | PersonCreationRationale, |
1014 | 53 | PersonVisibility, | 56 | PersonVisibility, |
1015 | 54 | PrivatePersonLinkageError, | ||
1016 | 55 | ) | 57 | ) |
1017 | 56 | from lp.registry.interfaces.product import IProductSet | 58 | from lp.registry.interfaces.product import IProductSet |
1018 | 57 | from lp.registry.model.karma import KarmaCategory | 59 | from lp.registry.model.karma import KarmaCategory |
1019 | 58 | 60 | ||
1020 | === modified file 'lib/lp/registry/tests/test_structuralsubscriptiontarget.py' | |||
1021 | --- lib/lp/registry/tests/test_structuralsubscriptiontarget.py 2010-08-20 20:31:18 +0000 | |||
1022 | +++ lib/lp/registry/tests/test_structuralsubscriptiontarget.py 2010-10-04 12:14:48 +0000 | |||
1023 | @@ -25,13 +25,15 @@ | |||
1024 | 25 | from canonical.testing import LaunchpadFunctionalLayer | 25 | from canonical.testing import LaunchpadFunctionalLayer |
1025 | 26 | from lp.bugs.interfaces.bug import CreateBugParams | 26 | from lp.bugs.interfaces.bug import CreateBugParams |
1026 | 27 | from lp.bugs.tests.test_bugtarget import bugtarget_filebug | 27 | from lp.bugs.tests.test_bugtarget import bugtarget_filebug |
1027 | 28 | from lp.registry.errors import ( | ||
1028 | 29 | DeleteSubscriptionError, | ||
1029 | 30 | UserCannotSubscribePerson, | ||
1030 | 31 | ) | ||
1031 | 28 | from lp.registry.interfaces.distribution import IDistributionSet | 32 | from lp.registry.interfaces.distribution import IDistributionSet |
1032 | 29 | from lp.registry.interfaces.product import IProductSet | 33 | from lp.registry.interfaces.product import IProductSet |
1033 | 30 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet | 34 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet |
1034 | 31 | from lp.registry.interfaces.structuralsubscription import ( | 35 | from lp.registry.interfaces.structuralsubscription import ( |
1035 | 32 | DeleteSubscriptionError, | ||
1036 | 33 | IStructuralSubscriptionTarget, | 36 | IStructuralSubscriptionTarget, |
1037 | 34 | UserCannotSubscribePerson, | ||
1038 | 35 | ) | 37 | ) |
1039 | 36 | from lp.registry.model.structuralsubscription import StructuralSubscription | 38 | from lp.registry.model.structuralsubscription import StructuralSubscription |
1040 | 37 | from lp.testing import ( | 39 | from lp.testing import ( |
1041 | 38 | 40 | ||
1042 | === modified file 'lib/lp/registry/tests/test_team_webservice.py' | |||
1043 | --- lib/lp/registry/tests/test_team_webservice.py 2010-09-24 21:10:47 +0000 | |||
1044 | +++ lib/lp/registry/tests/test_team_webservice.py 2010-10-04 12:14:48 +0000 | |||
1045 | @@ -3,6 +3,7 @@ | |||
1046 | 3 | 3 | ||
1047 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
1048 | 5 | 5 | ||
1049 | 6 | import httplib | ||
1050 | 6 | import unittest | 7 | import unittest |
1051 | 7 | 8 | ||
1052 | 8 | from lazr.restfulclient.errors import HTTPError | 9 | from lazr.restfulclient.errors import HTTPError |
1053 | @@ -44,7 +45,7 @@ | |||
1054 | 44 | team_one.addMember, | 45 | team_one.addMember, |
1055 | 45 | person=team_two) | 46 | person=team_two) |
1056 | 46 | self.assertIn('Cannot link person', api_error.content) | 47 | self.assertIn('Cannot link person', api_error.content) |
1058 | 47 | self.assertEqual(400, api_error.response.status) | 48 | self.assertEqual(httplib.FORBIDDEN, api_error.response.status) |
1059 | 48 | 49 | ||
1060 | 49 | 50 | ||
1061 | 50 | def test_suite(): | 51 | def test_suite(): |
Hi JC,
Thanks for doing this boring refactoring work. I just have a couple of minor comments below.
-Edwin
>=== modified file 'lib/lp/ registry/ interfaces/ distroseries. py' registry/ interfaces/ distroseries. py 2010-09-21 13:05:42 +0000 registry/ interfaces/ distroseries. py 2010-09-29 17:42:02 +0000 ditRestricted' , ublic', ries', returns_ collection_ of, returns_ entry, parameters_ as, launchpad. validators. email import email_validator launchpad. validators. name import name_validator launchpad. validators. version import sane_version interfaces. launchpad import IServiceUsage interfaces. specificationta rget import ISpecificationGoal interfaces. bugtarget import ( Tags,
>--- lib/lp/
>+++ lib/lp/
>@@ -12,7 +12,6 @@
> 'IDistroSeriesE
> 'IDistroSeriesP
> 'IDistroSeriesSet',
>- 'NoSuchDistroSe
> ]
>
> from lazr.enum import DBEnumeratedType
>@@ -26,7 +25,6 @@
> operation_
> operation_
> rename_
>- webservice_error,
> )
> from lazr.restful.fields import (
> Reference,
>@@ -51,7 +49,6 @@
> from canonical.
> from canonical.
> from canonical.
>-from lp.app.errors import NameLookupFailed
> from lp.app.
> from lp.blueprints.
> from lp.bugs.
>@@ -59,6 +56,7 @@
> IHasBugs,
> IHasOfficialBug
> )
>+from lp.registry.errors import NoSuchDistroSeries
It looks like we could use a separate file for special form fields, eField needs NoSuchDistroSeries, but we lose the
since DistroSeriesNam
benefit of moving that exception to lp.registry.errors, if we are just
going to import it. Can you open a bug for that?
> from lp.registry. interfaces. milestone import ( ies(NameLookupF ailed): error(400) #Bad request. circular_ imports. py registry/ interfaces/ person. py' registry/ interfaces/ person. py 2010-09-24 21:10:47 +0000 registry/ interfaces/ person. py 2010-09-29 17:42:02 +0000 returns_ entry, parameters_ as, views, interfaces. hasrecipes import IHasRecipes nkageError,
> IHasMilestones,
> IMilestone,
>@@ -858,11 +856,5 @@
> """
>
>
>-class NoSuchDistroSer
>- """Raised when we try to find a DistroSeries that doesn't exist."""
>- webservice_
>- _message_prefix = "No such distribution series"
>-
>-
> # Monkey patch for circular import avoidance done in
> # _schema_
>
>=== modified file 'lib/lp/
>--- lib/lp/
>+++ lib/lp/
>@@ -65,9 +61,7 @@
> operation_
> rename_
> REQUEST_USER,
>- webservice_error,
> )
>-from lazr.restful.error import expose
> from lazr.restful.fields import (
> CollectionField,
> Reference,
>@@ -121,6 +115,9 @@
> IHasRequestedRe
> )
> from lp.code.
>+from lp.registry.errors import (
>+ PrivatePersonLi
>+ )
Can you run utilities/ format- imports on all the files you touched
in this branch? This import will fit on a single line.
> from lp.registry. interfaces. gpg import IGPGKey interfaces. irc import IIrcID interfaces. jabber import IJabberID
> from lp.registry.
> from lp.registry.