commit 9ad8cfd417b7360d6f729d84f9000ab21ea1c37d Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Wed Mar 5 16:28:33 2014 +0100
Fix login against other instances of pkgdb, remember the user's username and fix the update_acl call
pkgdb.py | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) --- diff --git a/pkgdb.py b/pkgdb.py index b0ce83b..80d5498 100644 --- a/pkgdb.py +++ b/pkgdb.py @@ -49,15 +49,18 @@ class PkgDB(object):
'''
- def __init__(self, url=PKGDB_URL): + def __init__(self, url=PKGDB_URL, username=None): ''' Constructor fo the PkgDB object used to query the package database.
:kwarg url: the basic url to the package DB instance to query + :kwarg username: the FAS username of the user performing the + actions
''' self.url = url self.session = requests.session() + self.username = username self.__logged = False
@property @@ -84,7 +87,7 @@ class PkgDB(object): motif = re.compile(fedora_openid)
# Log into the service - response = self.session.get(PKGDB_URL + '/login/') + response = self.session.get(self.url + '/login/')
if '<title>OpenID transaction in progress</title>' \ in response.text: @@ -115,13 +118,13 @@ class PkgDB(object): verify=not openid_insecure) output = response.json()
+ if not output['success']: + raise PkgDBException(output['message']) + response = self.session.post( output['response']['openid.return_to'], data=output['response'])
- if not output['success']: - raise AuthError(output['message']) - self.__logged = True
return output @@ -337,8 +340,8 @@ class PkgDB(object):
args = { 'pkg_name': package, - 'pkg_branch': ','.join(branches), - 'pkg_acl': ','.join(acls), + 'pkg_branch': branches, + 'pkg_acl': acls, 'acl_status': status, 'pkg_user': user, }