* [gentoo-commits] gentoo-x86 commit in www-client/pybugz/files: pybugz-9999-bugzilla-4.4.1.patch
@ 2014-05-20 9:42 Justin Lecher (jlec)
0 siblings, 0 replies; 2+ messages in thread
From: Justin Lecher (jlec) @ 2014-05-20 9:42 UTC (permalink / raw
To: gentoo-commits
jlec 14/05/20 09:42:32
Added: pybugz-9999-bugzilla-4.4.1.patch
Log:
www-client/pybugz: Fix patch for live version
(Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!)
Revision Changes Path
1.1 www-client/pybugz/files/pybugz-9999-bugzilla-4.4.1.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/pybugz/files/pybugz-9999-bugzilla-4.4.1.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/pybugz/files/pybugz-9999-bugzilla-4.4.1.patch?rev=1.1&content-type=text/plain
Index: pybugz-9999-bugzilla-4.4.1.patch
===================================================================
bugz/cli.py | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/bugz/cli.py b/bugz/cli.py
index 5c8261b..ae57a10 100644
--- a/bugz/cli.py
+++ b/bugz/cli.py
@@ -29,6 +29,7 @@ BUGZ: ---------------------------------------------------
"""
DEFAULT_COOKIE_FILE = '.bugz_cookie'
+DEFAULT_TOKEN_FILE = '.bugz_token'
DEFAULT_NUM_COLS = 80
#
@@ -135,6 +136,12 @@ class PrettyBugz:
except IOError:
pass
+ self.token_file = os.path.join(os.environ['HOME'], DEFAULT_TOKEN_FILE)
+ try:
+ self.token = open(self.token_file).read().strip()
+ except IOError:
+ self.token = None
+
if getattr(args, 'encoding'):
self.enc = args.encoding
else:
@@ -151,16 +158,21 @@ class PrettyBugz:
def get_input(self, prompt):
return raw_input(prompt)
+ def set_token(self, *args):
+ if args and self.token:
+ args[0]['token'] = self.token
+ return args
+
def bzcall(self, method, *args):
"""Attempt to call method with args. Log in if authentication is required.
"""
try:
- return method(*args)
+ return method(*self.set_token(*args))
except xmlrpclib.Fault, fault:
# Fault code 410 means login required
if fault.faultCode == 410 and not self.skip_auth:
self.login()
- return method(*args)
+ return method(*self.set_token(*args))
raise
def login(self, args=None):
@@ -192,10 +204,21 @@ class PrettyBugz:
self.bz.User.login(params)
except xmlrpclib.Fault as fault:
raise BugzError("Can't login: " + fault.faultString)
+ log_info('Logging in')
+ result = self.bz.User.login(params)
+ if 'token' in result:
+ self.token = result['token']
if args is not None:
- self.cookiejar.save()
- os.chmod(self.cookiejar.filename, 0600)
+ if self.token:
+ fd = open(self.token_file, 'w')
+ fd.write(self.token)
+ fd.write('\n')
+ fd.close()
+ os.chmod(self.token_file, 0600)
+ else:
+ self.cookiejar.save()
+ os.chmod(self.cookiejar.filename, 0600)
def logout(self, args):
log_info('logging out')
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] gentoo-x86 commit in www-client/pybugz/files: pybugz-9999-bugzilla-4.4.1.patch
@ 2014-06-22 18:07 William Hubbs (williamh)
0 siblings, 0 replies; 2+ messages in thread
From: William Hubbs (williamh) @ 2014-06-22 18:07 UTC (permalink / raw
To: gentoo-commits
williamh 14/06/22 18:07:15
Removed: pybugz-9999-bugzilla-4.4.1.patch
Log:
Move the token support upstream
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0x30C46538)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-22 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-22 18:07 [gentoo-commits] gentoo-x86 commit in www-client/pybugz/files: pybugz-9999-bugzilla-4.4.1.patch William Hubbs (williamh)
-- strict thread matches above, loose matches on Subject: below --
2014-05-20 9:42 Justin Lecher (jlec)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox