launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #09269
Re: Help please - launchpadlib collections
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>
> Services will all be different, both in signatures and in semantics.
> Writing code that uses a service requires foreknowledge of that
> particular service, because
> 1. Without knowing what it does, you don't know that you want to use it
> 2. Without knowing its method signatures, you can't use it
>
> I agree that having a namespace for services would be useful, but I
> think using a collection to provide that namespace would be misleading.
>
I guess it comes down to preference. In terms of the core use case, we
really just talking about the mechanism to obtain a reference to the
service endpoint. In dynamic systems where services can be brought
up/down or upgraded on the fly, exposing a collection of available
services makes it easy to iterate over the provided services, making
metadata queries etc as required to discover what's available, what's
currently running, generate on the fly doco, and provide flexibility
with decisions around managing dynamic systems etc. I suppose we don't
need that sort of thing right now for Launchpad, but it's just as easy
to type:
lp.services['sharing']
as it is
lp.sharingService
And option 1 above is analogous conceptually (at least to me) to
lp.load('+services/sharing') which is also supported.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iJwEAQECAAYFAk+LnfwACgkQCJ79BCOJFcZ4DwP+PPWuFBRVOfNugreZBEuflAQ/
i/PYB4CWQ0DlaLBjDgy7inY8OPtTepu2yuWOinJSvwofa0/Usfe0fw0cE8lEeGCU
onEgFf3ciEqRRsv/MVVGVgVp9/AEEdaIAlZckJFe2G+NDVLrXDJUT2Tp84qxv87w
1XUPXnQ0nPaGH0OJfc8=
=HQek
-----END PGP SIGNATURE-----
References