commit 4bb78e414784dd796959542c961ee06bf7be0304 Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Thu Mar 6 11:23:09 2014 +0100
Raise an exception if trying to run a method w/o being authenticated
pkgdb.py | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) --- diff --git a/pkgdb.py b/pkgdb.py index 00ff4ee..17d4370 100644 --- a/pkgdb.py +++ b/pkgdb.py @@ -35,6 +35,14 @@ class PkgDBException(Exception): pass
+class PkgDBAuthException(Exception): + ''' Authentication exception raised when trying to call a method that + requires authentication while not being authenticated. + + ''' + pass + + def _parse_service_form(response): """ Retrieve the attributes from the html login form.
@@ -245,6 +253,9 @@ class PkgDB(object): :arg branches:
''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + if isinstance(packages, basestring): packages = [packages] if isinstance(branches, basestring): @@ -276,6 +287,9 @@ class PkgDB(object): :arg branches:
''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + if isinstance(packages, basestring): packages = [packages] if isinstance(branches, basestring): @@ -308,6 +322,9 @@ class PkgDB(object): :arg poc:
''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + if isinstance(packages, basestring): packages = [packages] if isinstance(branches, basestring): @@ -340,6 +357,9 @@ class PkgDB(object): :arg branches:
''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + if isinstance(packages, basestring): packages = [packages] if isinstance(branches, basestring): @@ -374,6 +394,9 @@ class PkgDB(object): :arg user:
''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + if isinstance(branches, basestring): branches = [branches] if isinstance(acls, basestring):
packagedb-cli-commits@lists.stg.fedorahosted.org