No subject


Mon May 11 02:30:56 BST 2009


URL.

As said above, I've yet to study launchpadlib, so I may miss
something obvious.

    jml> =3D=3D=3D modified file 'bzrlib/plugins/launchpad/lp_directory.py'
    jml> --- bzrlib/plugins/launchpad/lp_directory.py	2009-03-23 14:59:43 +=
0000
    jml> +++ bzrlib/plugins/launchpad/lp_directory.py	2009-07-03 14:24:23 +=
0000
    jml> @@ -63,15 +63,9 @@
    jml>                   _request_factory=3DResolveLaunchpadPathRequest,
    jml>                   _lp_login=3DNone):
    jml>          """Resolve the base URL for this transport."""
    jml> +        service =3D LaunchpadService.for_url(url)
    jml>          result =3D urlsplit(url)
    jml> -        # Perform an XMLRPC request to resolve the path
    jml> -        lp_instance =3D result[1]
    jml> -        if lp_instance =3D=3D '':
    jml> -            lp_instance =3D None
    jml> -        elif lp_instance not in LaunchpadService.LAUNCHPAD_INSTAN=
CE:
    jml> -            raise errors.InvalidURL(path=3Durl)
    jml>          resolve =3D _request_factory(result[2].strip('/'))
    jml> -        service =3D LaunchpadService(lp_instance=3Dlp_instance)


Can we get that without the rest of your patch ?

    jml> =3D=3D=3D modified file 'bzrlib/plugins/launchpad/lp_registration.=
py'

<snip/>
=20
    jml> +    @classmethod
    jml> +    def for_url(cls, url, **kwargs):
    jml> +        """Return the Launchpad service corresponding to the give=
n URL."""
    jml> +        result =3D urlsplit(url)
    jml> +        lp_instance =3D result[1]
    jml> +        if lp_instance =3D=3D '':
    jml> +            lp_instance =3D None
    jml> +        elif lp_instance not in cls.LAUNCHPAD_INSTANCE:
    jml> +            raise errors.InvalidURL(path=3Durl)
    jml> +        return cls(lp_instance=3Dlp_instance, **kwargs)
    jml> +

<snip/>

As for testing strategy, I'd go with the dumbest lp server you
can think of with a list of needed requests and an associated
list of pre-canned responses.

You will certainly need to avoid using https and make
CACHE_DIRECTORY and LAUNCHPAD_API_URLS overridable by tests.

And while you work on that, now that you mention it, you may
try to give https://bugs.edge.launchpad.net/bzr/+bug/186920 a
shot, especially taking
https://bugs.edge.launchpad.net/bzr/+bug/186920/comments/31 into
consideration...:-P

        Vincent



More information about the bazaar mailing list