From: Zhang Qiang Date: Mon, 6 Aug 2012 05:18:15 +0000 (+0800) Subject: cmd_build: Fixed check for empty user and password. Fixes #217. X-Git-Tag: 0.9~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b37d5a999de19a9164c1946b287abe8613899456;p=tools%2Fgbs.git cmd_build: Fixed check for empty user and password. Fixes #217. --- diff --git a/gitbuildsys/cmd_build.py b/gitbuildsys/cmd_build.py index 66488de..d69c81a 100644 --- a/gitbuildsys/cmd_build.py +++ b/gitbuildsys/cmd_build.py @@ -222,14 +222,17 @@ def get_repos_conf(): user = item.get('user') or splitted.username passwd = item.get('passwd') or splitted.password - if (user and not passwd) or (passwd and not user): - raise errors.ConfigError("Both user and password " - "has to be specified for %s" % key) - splitted_list = list(splitted) - if user and passwd: - splitted_list[1] = "%s:%s@%s" % (urllib2.quote(user, safe=''), \ - passwd, splitted.hostname) + if user: + if passwd: + splitted_list[1] = '%s:%s@%s' % (urllib2.quote(user, safe=''), + passwd, splitted.hostname) + else: + splitted_list[1] = '%s@%s' % (urllib2.quote(user, safe=''), + splitted.hostname) + elif passwd: + raise errors.ConfigError('No user is specified for %s, '\ + 'only password' % key) result.append(urlunsplit(splitted_list))