Allow bugzilla username and password to be None and use cookie auth

For custom hooks using gitzilla.hooks.post_receive and
gitzilla.hooks.update, cookie auth can be used now. The cookie file is
generated by pybugz and is at ~/.bugz_cookie
master
Devendra Gera 2010-03-14 03:07:43 +05:30
parent db482dcd6d
commit e6c1bc0b7f
2 changed files with 6 additions and 7 deletions

View File

@ -19,7 +19,8 @@ def post_receive(sBZUrl, sBZUser, sBZPasswd, sFormatSpec=None, oBugRegex=None, s
info to the comment. If multiple bug ids are found, the comment is added
to each of those bugs.
sBZUrl is the base URL for the Bugzilla installation.
sBZUrl is the base URL for the Bugzilla installation. If sBZUser and
sBZPasswd are None, then it uses the ~/.bugz_cookie cookiejar.
oBugRegex specifies the regex used to search for the bug id in the commit
messages. It MUST provide a named group called 'bug' which contains the bug
@ -133,9 +134,8 @@ def update(oBugRegex=None, asAllowedStatuses=None, sSeparator=None, sBZUrl=None,
if asAllowedStatuses is not None:
# sanity checking
for item in (sBZUrl, sBZUser):
if item is None:
raise ValueError("Bugzilla info required for status checks")
if sBZUrl is None:
raise ValueError("Bugzilla info required for status checks")
# create and cache bugzilla instance
oBZ = bugz.bugzilla.Bugz(sBZUrl, user=sBZUser, password=sBZPasswd)

View File

@ -54,9 +54,8 @@ def post_to_bugzilla(iBugId, sComment, sBZUrl, sBZUser, sBZPasswd):
"""
posts the comment to the given bug id.
"""
for item in (sBZUrl, sBZUser, sBZPasswd):
if item is None:
raise ValueError("Bad bugzilla info")
if sBZUrl is None:
raise ValueError("No Bugzilla URL specified")
oBZ = bugz.bugzilla.Bugz(sBZUrl, user=sBZUser, password=sBZPasswd)
oBZ.modify(iBugId, comment=sComment)