14
0

Accepting request 1044063 from home:juliogonzalezgil:branches:devel:languages:python

Update to 3.2.0.

Verified:
- Module works with HTTP auth for the current bugzilla.opensuse.org
- Module works with the API Key auth for the newer bugzilla versions  (API Key auth not available at bugzilla.opensuse.org as of today)
- Module works with the XMLRPC API for both current bugzilla.opensuse.org and newer bugzilla versions.
- Module works with the REST API for newer bugzilla version (REST API not available at bugzilla.opensuse.org as of today)

OBS-URL: https://build.opensuse.org/request/show/1044063
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bugzilla?expand=0&rev=55
This commit is contained in:
2022-12-21 13:02:48 +00:00
committed by Git OBS Bridge
parent 0b17ae3011
commit 81bd800272
5 changed files with 34 additions and 32 deletions

View File

@@ -1,12 +1,6 @@
--- --- python-bugzilla-3.2.0.orig/bugzilla/base.py 2022-01-12 19:09:08.000000000 +0100
bugzilla/base.py | 8 +++++++- +++ python-bugzilla-3.2.0/bugzilla/base.py 2022-12-21 09:32:01.324613243 +0100
1 file changed, 7 insertions(+), 1 deletion(-) @@ -174,7 +174,8 @@
Index: python-bugzilla-3.0.2/bugzilla/base.py
===================================================================
--- python-bugzilla-3.0.2.orig/bugzilla/base.py
+++ python-bugzilla-3.0.2/bugzilla/base.py
@@ -175,7 +175,8 @@ class Bugzilla(object):
def __init__(self, url=-1, user=None, password=None, cookiefile=-1, def __init__(self, url=-1, user=None, password=None, cookiefile=-1,
sslverify=True, tokenfile=-1, use_creds=True, api_key=None, sslverify=True, tokenfile=-1, use_creds=True, api_key=None,
cert=None, configpaths=-1, cert=None, configpaths=-1,
@@ -16,7 +10,7 @@ Index: python-bugzilla-3.0.2/bugzilla/base.py
""" """
:param url: The bugzilla instance URL, which we will connect :param url: The bugzilla instance URL, which we will connect
to immediately. Most users will want to specify this at to immediately. Most users will want to specify this at
@@ -212,6 +213,7 @@ class Bugzilla(object): @@ -207,6 +208,7 @@
:param requests_session: An optional requests.Session object the :param requests_session: An optional requests.Session object the
API will use to contact the remote bugzilla instance. This API will use to contact the remote bugzilla instance. This
way the API user can set up whatever auth bits they may need. way the API user can set up whatever auth bits they may need.
@@ -24,28 +18,25 @@ Index: python-bugzilla-3.0.2/bugzilla/base.py
""" """
if url == -1: if url == -1:
raise TypeError("Specify a valid bugzilla url, or pass url=None") raise TypeError("Specify a valid bugzilla url, or pass url=None")
@@ -253,6 +255,7 @@ class Bugzilla(object): @@ -246,6 +248,7 @@
self._setcookiefile(cookiefile)
self._settokenfile(tokenfile) self._settokenfile(tokenfile)
self._setconfigpath(configpaths) self._setconfigpath(configpaths)
+ self._basic_auth = basic_auth + self._basic_auth = basic_auth
if url: if url:
self.connect(url) self.connect(url)
@@ -607,6 +610,9 @@ class Bugzilla(object): @@ -598,6 +601,8 @@
raise ValueError("missing username")
if not self.password: if not self.password:
raise ValueError("missing password") raise ValueError("missing password")
+ if self._basic_auth: + if self._basic_auth:
+ self._backend.set_basic_auth(self.user, self.password) + self._backend.set_basic_auth(self.user, self.password)
+
payload = {"login": self.user} payload = {"login": self.user}
if restrict_login: if restrict_login:
payload['restrict_login'] = True --- python-bugzilla-3.2.0.orig/bugzilla/_backendxmlrpc.py 2022-01-12 19:09:08.000000000 +0100
Index: python-bugzilla-3.0.2/bugzilla/_backendxmlrpc.py +++ python-bugzilla-3.2.0/bugzilla/_backendxmlrpc.py 2022-12-21 09:35:40.471278786 +0100
===================================================================
--- python-bugzilla-3.0.2.orig/bugzilla/_backendxmlrpc.py
+++ python-bugzilla-3.0.2/bugzilla/_backendxmlrpc.py
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
# See the COPYING file in the top-level directory. # See the COPYING file in the top-level directory.
@@ -54,23 +45,23 @@ Index: python-bugzilla-3.0.2/bugzilla/_backendxmlrpc.py
import sys import sys
from xmlrpc.client import (Binary, Fault, ProtocolError, from xmlrpc.client import (Binary, Fault, ProtocolError,
ServerProxy, Transport) ServerProxy, Transport)
@@ -136,6 +137,9 @@ class _BugzillaXMLRPCProxy(ServerProxy, @@ -127,6 +128,9 @@
self.__bugzillasession.set_token_value(ret.get('token')) # pylint: enable=no-member
return ret
return ret
+
+ def clear_token(self): + def clear_token(self):
+ self.__bugzillasession.set_token_value(None) + self.__bugzillasession.set_token_value(None)
+
class _BackendXMLRPC(_BackendBase): class _BackendXMLRPC(_BackendBase):
""" @@ -142,6 +146,16 @@
@@ -150,6 +154,16 @@ class _BackendXMLRPC(_BackendBase):
def is_xmlrpc(self): def is_xmlrpc(self):
return True return True
+ def set_basic_auth(self, user, password): + def set_basic_auth(self, user, password):
+ """ + """
+ Set basic authentication method. + Set basic authentication method.
+ +
+ :return: + :return:
+ """ + """

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f251da6d2317d57f8b4abf354e5200250cab7b3ea0a5f0c6eb67dce7240f6966
size 115324

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:54967b21001e880b20c9303d5ac86b009142714ee6cdb473be363c41b207dd15
size 113206

View File

@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Dec 21 08:41:46 UTC 2022 - Julio González Gil <jgonzalez@suse.com>
- Update to 3.2.0:
* Use soon-to-be-required Authorization header for RH bugzilla
* Remove cookie auth support
* Detect bugzilla.stage.redhat.com as RHBugzilla
* Add limit as option to build_query
- Modified:
* 106-basic-auth.diff
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 26 10:25:23 UTC 2021 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com> Tue Oct 26 10:25:23 UTC 2021 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-bugzilla # spec file for package python-bugzilla
# #
# Copyright (c) 2021 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
%define oldpython python %define oldpython python
%define skip_python2 1 %define skip_python2 1
Name: python-bugzilla Name: python-bugzilla
Version: 3.0.2 Version: 3.2.0
Release: 0 Release: 0
Summary: Python library for Bugzilla Summary: Python library for Bugzilla
License: GPL-2.0-or-later License: GPL-2.0-or-later