Merge lp:~jelmer/bzr-builddeb/newlplib into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Superseded
Proposed branch: lp:~jelmer/bzr-builddeb/newlplib
Merge into: lp:bzr-builddeb
Diff against target: 33 lines (+12/-10)
1 file modified
launchpad.py (+12/-10)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/newlplib
Reviewer Review Type Date Requested Status
James Westby Needs Fixing
Review via email: mp+52198@code.launchpad.net

This proposal has been superseded by a proposal from 2011-03-05.

Description of the change

Support the new mechanism for logging in in launchpadlib.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Hi,

This change doesn't preserve this existing behaviour.

22 + if not os.path.exists(creds_path):
23 + return None

Maybe we don't want that any more, but if not we should
drop it from both code paths.

Thanks,

James

review: Needs Fixing
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> This change doesn't preserve this existing behaviour.
>
> 22 + if not os.path.exists(creds_path):
> 23 + return None
>
> Maybe we don't want that any more, but if not we should
> drop it from both code paths.
In what way is that incompatible? Because we'll now perhaps prompt the user to log in ?

I guess we could use "Launchpad.login_anonymously" as an alternative.

Cheers,

Jelmer

Revision history for this message
James Westby (james-w) wrote :

On Fri, 04 Mar 2011 19:06:17 -0000, Jelmer Vernooij <email address hidden> wrote:
> > This change doesn't preserve this existing behaviour.
> >
> > 22 + if not os.path.exists(creds_path):
> > 23 + return None
> >
> > Maybe we don't want that any more, but if not we should
> > drop it from both code paths.
> In what way is that incompatible? Because we'll now perhaps prompt the user to log in ?

Yeah. IIRC this was done so that you had to explicitly configure it, as
I didn't want to prompt everyone for credentials when this is a feature
that won't have any effect in the vast majority of cases, except for the
importer.

> I guess we could use "Launchpad.login_anonymously" as an alternative.

That would at least avoid the prompt wouldn't it? I'm still not sure it
is worth the round trips, given that the feature is mainly useful for
the importer.

Thanks,

James

lp:~jelmer/bzr-builddeb/newlplib updated
537. By Jelmer Vernooij

Login into launchpad anonymously.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launchpad.py'
2--- launchpad.py 2010-09-10 02:46:41 +0000
3+++ launchpad.py 2011-03-04 21:34:15 +0000
4@@ -33,17 +33,19 @@
5
6
7 def _get_launchpad():
8- creds_path = os.path.join(config_dir(), "builddeb.lp_creds.txt")
9- if not os.path.exists(creds_path):
10- return None
11- creds = Credentials("bzr-builddeb")
12- f = open(creds_path)
13 try:
14- creds.load(f)
15- finally:
16- f.close()
17- lp = Launchpad(creds, service_root=LPNET_SERVICE_ROOT)
18- return lp
19+ return Launchpad.login_anonymously("bzr-builddeb", "production")
20+ except AttributeError: # older version of launchpadlib
21+ creds_path = os.path.join(config_dir(), "builddeb.lp_creds.txt")
22+ if not os.path.exists(creds_path):
23+ return None
24+ creds = Credentials("bzr-builddeb")
25+ f = open(creds_path)
26+ try:
27+ creds.load(f)
28+ finally:
29+ f.close()
30+ return Launchpad(creds, service_root=LPNET_SERVICE_ROOT)
31
32
33 def ubuntu_bugs_for_debian_bug(bug_id):

Subscribers

People subscribed via source and target branches