Skip to content

Commit

Permalink
Minor fixes to jirashell issues #100, #102, and #66, and tweaks fix f…
Browse files Browse the repository at this point in the history
…rom d585674. The oauth_dance and print_tokens options specified in jirashell.ini configuration file are now correctly parsed as boolean values and OAuth with pre-authenticated access_token and access_token_secret (skipping oauth_dance) is fixed. OAuth options are now minimally validated for completeness, so #66 is fixed, allowing for basic_auth without causing issue #102 as the merged commit d585674 did previously.
  • Loading branch information
milo-minderbinder committed Jul 15, 2015
1 parent 05e77f9 commit 1425bb8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jira/jirashell.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ def process_config():
basic_auth = {}

if parser.has_section('oauth'):
oauth = dict(parser.items('oauth'))
oauth = {}
for option, value in parser.items('oauth'):
if option in ("oauth_dance", "print_tokens"):
value = parser.getboolean('oauth', option)
oauth[option] = value
else:
oauth = {}

Expand Down Expand Up @@ -239,9 +243,12 @@ def main():
if basic_auth:
basic_auth = (basic_auth['username'], basic_auth['password'])

if 'oauth_dance' in oauth and oauth['oauth_dance']:
if oauth.get('oauth_dance') is True:
oauth = oauth_dance(
options['server'], oauth['consumer_key'], oauth['key_cert'], oauth['print_tokens'], options['verify'])
elif not all((oauth.get('access_token'), oauth.get('access_token_secret'),
oauth.get('consumer_key'), oauth.get('key_cert'))):
oauth = None

jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

Expand Down

0 comments on commit 1425bb8

Please sign in to comment.