[Python-modules-commits] r18139 - in packages/python-launchpadlib/trunk/debian (3 files)

dktrkranz at users.alioth.debian.org dktrkranz at users.alioth.debian.org
Fri Aug 12 14:30:59 UTC 2011


    Date: Friday, August 12, 2011 @ 14:30:58
  Author: dktrkranz
Revision: 18139

Add a delay before attempting to launch browser (Closes: #584556)

Added:
  packages/python-launchpadlib/trunk/debian/patches/auth_message.patch
Modified:
  packages/python-launchpadlib/trunk/debian/changelog
  packages/python-launchpadlib/trunk/debian/patches/series

Modified: packages/python-launchpadlib/trunk/debian/changelog
===================================================================
--- packages/python-launchpadlib/trunk/debian/changelog	2011-08-12 07:24:12 UTC (rev 18138)
+++ packages/python-launchpadlib/trunk/debian/changelog	2011-08-12 14:30:58 UTC (rev 18139)
@@ -1,3 +1,10 @@
+python-launchpadlib (1.9.9-2) unreleased; urgency=low
+
+  * debian/patches/auth_message.patch:
+    - Add a delay before attempting to launch browser (Closes: #584556).
+
+ -- Luca Falavigna <dktrkranz at debian.org>  Fri, 12 Aug 2011 16:29:40 +0200
+
 python-launchpadlib (1.9.9-1) unstable; urgency=low
 
   * New upstream release.

Added: packages/python-launchpadlib/trunk/debian/patches/auth_message.patch
===================================================================
--- packages/python-launchpadlib/trunk/debian/patches/auth_message.patch	                        (rev 0)
+++ packages/python-launchpadlib/trunk/debian/patches/auth_message.patch	2011-08-12 14:30:58 UTC (rev 18139)
@@ -0,0 +1,48 @@
+Description: Add a delay before attempting to launch browser
+Author: Luca Falavigna <dktrkranz at debian.org>
+Bug-Debian: http://bugs.debian.org/584556
+Forwarded: https://launchpad.net/launchpadlib/+bug/643699
+
+Index: python-launchpadlib-1.9.9/src/launchpadlib/credentials.py
+===================================================================
+--- python-launchpadlib-1.9.9.orig/src/launchpadlib/credentials.py	2011-08-12 16:03:32.135963413 +0200
++++ python-launchpadlib-1.9.9/src/launchpadlib/credentials.py	2011-08-12 16:25:06.104003055 +0200
+@@ -31,7 +31,9 @@
+ from cStringIO import StringIO
+ import httplib2
+ import os
++from select import select
+ import stat
++from sys import stdin
+ import time
+ from urllib import urlencode
+ from urlparse import urljoin
+@@ -500,7 +502,10 @@
+     themselves.
+     """
+ 
+-    WAITING_FOR_USER = "The authorization page:\n (%s)\nshould be opening in your browser. Use your browser to authorize\nthis program to access Launchpad on your behalf. \n\nWaiting to hear from Launchpad about your decision..."
++    WAITING_FOR_USER = "The authorization page:\n (%s)\nshould be opening in your browser. Use your browser to authorize\nthis program to access Launchpad on your behalf."
++    TIMEOUT_MESSAGE = "Press any key to continue or wait (%d) seconds..."
++    TIMEOUT = 5
++    WAITING_FOR_LAUNCHPAD = "Waiting to hear from Launchpad about your decision..."
+ 
+     def __init__(self, service_root, application_name, consumer_name=None,
+                  credential_save_failed=None, allow_access_levels=None):
+@@ -536,8 +541,15 @@
+         """Have the end-user authorize the token in their browser."""
+ 
+         authorization_url = self.authorization_url(request_token)
+-        webbrowser.open(authorization_url)
+         self.output(self.WAITING_FOR_USER % authorization_url)
++        self.output(self.TIMEOUT_MESSAGE % self.TIMEOUT)
++        # Wait a little time before attempting to launch browser,
++        # give users the chance to press a key to skip it anyway.
++        rlist, _, _ = select([stdin], [], [], self.TIMEOUT)
++        if rlist:
++            stdin.readline()
++        self.output(self.WAITING_FOR_LAUNCHPAD)
++        webbrowser.open(authorization_url)
+         while credentials.access_token is None:
+             time.sleep(access_token_poll_time)
+             try:

Modified: packages/python-launchpadlib/trunk/debian/patches/series
===================================================================
--- packages/python-launchpadlib/trunk/debian/patches/series	2011-08-12 07:24:12 UTC (rev 18138)
+++ packages/python-launchpadlib/trunk/debian/patches/series	2011-08-12 14:30:58 UTC (rev 18139)
@@ -1 +1,2 @@
 no_package_data.patch
+auth_message.patch




More information about the Python-modules-commits mailing list