Merge lp:~jcsackett/launchpad/registry-errors-649836 into lp:launchpad
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.
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.