Merge lp://staging/~jpds/launchpad/fix_361650_model_changes into lp://staging/launchpad
Proposed by
Jonathan Davies
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 10619 |
Proposed branch: | lp://staging/~jpds/launchpad/fix_361650_model_changes |
Merge into: | lp://staging/launchpad |
Diff against target: |
857 lines (+470/-93) 11 files modified
lib/lp/registry/configure.zcml (+47/-5) lib/lp/registry/doc/distribution-mirror.txt (+119/-1) lib/lp/registry/interfaces/distribution.py (+9/-1) lib/lp/registry/interfaces/distributionmirror.py (+96/-47) lib/lp/registry/model/distribution.py (+11/-0) lib/lp/registry/model/distributionmirror.py (+63/-1) lib/lp/registry/stories/distributionmirror/xx-distribution-mirrors.txt (+11/-11) lib/lp/registry/stories/webservice/xx-distribution-mirror.txt (+20/-11) lib/lp/registry/stories/webservice/xx-distribution.txt (+74/-0) lib/lp/registry/tests/test_distributionmirror.py (+4/-14) lib/lp/testing/factory.py (+16/-2) |
To merge this branch: | bzr merge lp://staging/~jpds/launchpad/fix_361650_model_changes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Review via email: mp+20785@code.staging.launchpad.net |
Commit message
Added models and tests for DistributionMir
Description of the change
= Summary =
This branch builds on the schema changes introduced for bug #361650. Adding stuff to our models.
It also adds the API parts and mirror checks when marking mirrors as country mirrors with complete test suite.
To post a comment you must log in.
Your merge proposal should show the output of make lint to verify your
changes did not have any cruft. It will also inform you of style mistakes
that must be fixed before making a merge proposal.
I have some ideas to improve the code, and I think the interface and model
are missing essential documentation and unit tests. I suspect that the
story tests (which are integration tests) are test what should be testing
as documentation and unit tests.
> === modified file 'lib/lp/ registry/ interfaces/ distribution. py' registry/ interfaces/ distribution. py 2010-02-27 10:19:18 +0000 registry/ interfaces/ distribution. py 2010-03-06 00:09:35 +0000 parameters( copy_field( IDistributionMi rror['country' ], required=True), type=copy_ field(IDistribu tionMirror[ 'content' ], required=True)) returns_ entry(IDistribu tionMirror) read_operation( ) r(country, mirror_type):
> --- lib/lp/
> +++ lib/lp/
> @@ -318,6 +318,16 @@
> if it's not found.
> """
>
> + @operation_
> + country=
> + mirror_
> + @operation_
> + @export_
> + def getCountryMirro
> + """Return the country DNS mirror for a given country and content
> + type.
> + """
> +
This docstring does not follow PEP 257. The first sentence must be one line. www.python. org/dev/ peps/pep- 0257/
Subsequent sentences may follow after a blank line:
http://
Think this fixes the issue:
"""Return the country DNS mirror for a country and content type."""
> === modified file 'lib/lp/ registry/ interfaces/ distributionmir ror.py' registry/ interfaces/ distributionmir ror.py 2010-02-22 15:50:06 +0000 registry/ interfaces/ distributionmir ror.py 2010-03-06 00:09:35 +0000 ionToCountryMir ror', AlreadySet' , irror', MirrorAdminRest ricted' , MirrorEditRestr icted', MirrorPublic' , rchSeries' , eriesSource' , cord', irrorSet' , DistroSeries' , CDImageFileList ', TPUrl', cial', CDImageFileList ']
> --- lib/lp/
> +++ lib/lp/
> @@ -6,21 +6,23 @@
> __metaclass__ = type
>
> __all__ = [
> +'CannotTransit
> +'CountryMirror
> 'IDistributionM
> -'IDistribution
> -'IDistribution
> -'IDistribution
> 'IMirrorDistroA
> 'IMirrorDistroS
> 'IMirrorProbeRe
> 'IDistributionM
> 'IMirrorCDImage
> 'PROBE_INTERVAL',
> -'UnableToFetch
> 'MirrorContent',
> 'MirrorFreshness',
> +'MirrorHasNoHT
> +'MirrorNotOffi
> +'MirrorNotProbed',
> 'MirrorSpeed',
> -'MirrorStatus']
> +'MirrorStatus',
> +'UnableToFetch
Per PEP 8, this list of single entries must each be indented and required a
trailing comma; the closing bracket on on a separate line to minimise diffs,
which I can see that this diff is already a victim:
'MirrorStatus', tchCDImageFileL ist',
'UnableToFe
]
> @@ -47,6 +52,44 @@ nToCountryMirro r(Exception) :
> PROBE_INTERVAL = 23
>
> +class CannotTransitio
> + """Root exception for transitions to country mirrors.
> + """
The closing quotes belong on the previous line PEP 257.
> + webservice_ error(400) # HTTP Error: 'Bad Request'.
Launchpad style does not use trailing comments because they interfere with
refactoring. I do not think comments about HTTP codes are informative;
we are expect to know them.
> @@ -386,6 +406,33 @@
> date_created = exported(Datetime(
> title=_('Date Crea...