Skip to content
Permalink
Browse files

Only initialize the Bugzilla connection when needed

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
  • Loading branch information...
puiterwijk committed Sep 28, 2016
1 parent f340915 commit 950eee2c6be0235128269f60c07fee48f39d9874
Showing with 14 additions and 5 deletions.
  1. +14 −5 bodhi/server/bugs.py
@@ -53,17 +53,26 @@ class InvalidComment(Exception):
class Bugzilla(BugTracker):

def __init__(self):
self._bz = None

def _connect(self):
user = config.get('bodhi_email')
password = config.get('bodhi_password', None)
url = config.get("bz_server")
log.info("Using BZ URL %s" % url)
if user and password:
self.bz = bugzilla.Bugzilla(url=url,
user=user, password=password,
cookiefile=None, tokenfile=None)
self._bz = bugzilla.Bugzilla(url=url,
user=user, password=password,
cookiefile=None, tokenfile=None)
else:
self.bz = bugzilla.Bugzilla(url=url,
cookiefile=None, tokenfile=None)
self._bz = bugzilla.Bugzilla(url=url,
cookiefile=None, tokenfile=None)

@property
def bz(self):
if self._bz is None:
self._connect()
return self._bz

def get_url(self, bug_id):
return "%s/show_bug.cgi?id=%s" % (config['bz_baseurl'], bug_id)

0 comments on commit 950eee2

Please sign in to comment.
You can’t perform that action at this time.