summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2012-04-19 15:58:09 +0200
committerPawel Hajdan, Jr <phajdan.jr@gentoo.org>2012-04-19 15:58:09 +0200
commit535da2a53b24e20444b09f89a6055f89784cfce3 (patch)
tree3be1ed596c917c2ceec015cf152c60037d5bcbdd
parentAlso consider STABLEREQ bugs for maintainer timeout. (diff)
downloadarch-tools-535da2a53b24e20444b09f89a6055f89784cfce3.tar.gz
arch-tools-535da2a53b24e20444b09f89a6055f89784cfce3.tar.bz2
arch-tools-535da2a53b24e20444b09f89a6055f89784cfce3.zip
The new python interface to bugzilla does not handle logging in and out
at the lower level; this is now part of the command line interface. As a result, we need to prompt for a username and password and log in ourselves. This will be used in the updated arch testing tools.
-rw-r--r--common.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/common.py b/common.py
index ad25ad8..16abf70 100644
--- a/common.py
+++ b/common.py
@@ -3,6 +3,7 @@
import cStringIO
import datetime
+import getpass
import re
import portage
@@ -42,6 +43,27 @@ def expand_braces(orig):
return list(set(res))
+def get_input(prompt):
+ return raw_input(prompt)
+
+
+def login(bugzilla):
+ """Authenticate a session.
+ """
+ # prompt for username
+ user = get_input('Bugzilla Username: ')
+
+ # prompt for password
+ password = getpass.getpass()
+
+ # perform login
+ params = {}
+ params['login'] = user
+ params['password'] = password
+ print 'Logging in'
+ bugzilla.User.login(params)
+
+
class Bug:
def __init__(self, xml=None, id_number=None, summary=None, status=None):
if xml is not None: