Merge lp:~jpds/launchpad/fix_361650_model_changes into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Curtis Hovey on 2010-04-05 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 10619 |
| Proposed branch: | lp:~jpds/launchpad/fix_361650_model_changes |
| Merge into: | lp: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:~jpds/launchpad/fix_361650_model_changes |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Curtis Hovey (community) | code | 2010-03-05 | Approve on 2010-04-05 |
|
Review via email:
|
|||
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.
| Curtis Hovey (sinzui) wrote : | # |
Hi Jonathan.
I have some trivial suggestions to improve this branch. I think the implementation
is good and ready to land.
I can land the branch at the end of this week after these changes are made.
make lint reported these problems that need fixing:
lib/lp/
339: [C0301] Line too long (83/78)
436: [W0311] Bad indentation. Found 7 spaces, expected 8
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
@@ -814,3 +814,107 @@
> +Country DNS mirrors
> +------
> +
> +Country DNS mirrors are mirrors which have been assigned $CC.archive.
> +or $CC.releases.
Wrap the narrative at 78 characters.
> + >>> login('<email address hidden>')
> + >>> ubuntu_distro = getUtility(
> + >>> de_archive_mirror = factory.
> + ... "Technische Universitaet Dresden", country=82,
> + ... http_url="http://
> + ... official_
> + >>> davis_station_
> + ... "Davis Station", country=9,
> + ... http_url="http://
> + ... official_
> + >>> de_archive_
> + >>> de_archive_
> + >>> logout()
Wrap the code at 78 characters.
...
> +Mirrors which are not official or do not have an HTTP URL may not be set as
> +country mirrors:
> +
> + >>> login('<email address hidden>')
> + >>> osuosl_mirror = factory.
> + ... country=226,
> + ... ftp_url="ftp://ubuntu.
> + ... official_
> + >>> osuosl_
> + >>> print osuosl_
> + None
Wrap the code at 78 characters.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
>
> @@ -321,6 +321,14 @@
> if it's not found.
> """
>
> + @operation_
> + country=
> + mirror_
> + @operation_
> + @export_
> + def getCountryMirro
> + """Return the country DNS mirror for acountry and content type."""
grammar: s/acountry/a country/
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -6,21 +6,24 @@
> __metaclass__ = type
__all__ = [
...
> + ...

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...