Comment 20 for bug 714043

Revision history for this message
Leonard Richardson (leonardr) wrote :

"Are you really changing that parameter from being a URL to being a
symbolic name? That seems likely to break client applications."

I didn't explain this very well. Let me try again.

1. The value of uris.LPNET_SERVICE_ROOT is 'https://api.launchpad.net/api/'. This has been the case since before 1.6.1. You can run this code and it will work, in maverick or natty.
from launchpadlib.launchpad import Launchpad
from launchpadlib.uris import LPNET_SERVICE_ROOT
Launchpad.login_with("foo", LPNET_SERVICE_ROOT)

If this doesn't work, I'd like to know why.

2. However, I never envisioned this usage. This is the usage I envisioned:

from launchpadlib.launchpad import Launchpad
Launchpad.login_with("foo", "production")

This will also work in maverick or natty, and if it doesn't work I'd like to know why.

3. Behind the scenes, the string "production" is mapped to the string 'https://api.launchpad.net/api/'.

4. If I were to change the constant LPNET_SERVICE_ROOT so that it was 'production' instead of 'https://api.launchpad.net/api/', this should have no effect on clients. Unless, some client is assuming that LPNET_SERVICE_ROOT is a URL and doing URL manipulation on the value.

5. I don't have a problem with someone prefering to import a Python constant LPNET_SERVICE_ROOT rather than use a hard-coded string "production". But if you're all about importing constants, you shouldn't also be performing URL manipulation on the constants. It shouldn't make a difference to you if I change the value of the constants.

So, coming back to your original statement:

"At the moment in Ubuntu's stable release, they must either hardcode a
URL or do the moral equivalent through string manipulation, because
there is no symbol for LPNET_SERVICE_ROOT"

In Ubuntu's stable release, there is a symbol for LPNET_SERVICE_ROOT: it's uris.LPNET_SERVICE_ROOT. You can also use the string "production". If it turns out people would rather use uris.LPNET_SERVICE_ROOT than "production", I would like to change the value of uris.LPNET_SERVICE_ROOT to "production". Otherwise, people might get the idea that they can do URL manipulation on these constants, when they're actually supposed to be nothing but useful constants for people to pass into login_with().