Patch for Python 3 Support
by Ralph Bean
Hello all,
I created a patch to update python-bugzilla to work on both python 2
and python 3. The unit tests all pass under both py2.7 and py3.2.
I have tested the login and query commands by hand on py2.6, py2.7,
and py3.2.
http://threebean.org/patches/python-bugzilla-Python3-support.patch
The patch is against the master branch (7ca8a60). If I should
recreate it against another branch, please let me know.
I'm also willing to update and maintain a spec file supporting both
versions if and when that time comes.
Cheers-
-Ralph
10 years, 9 months
Problem with my boolean query
by Eric Sammons
Hi,
I'm trying to write a simple python program that would search for all bugs
with a specific set of flags. Using the bugzilla cli the boolean query
works.
<cli>
bugzilla query --product='Red Hat Enterprise MRG'
--component='distribution, qpid-cpp, qpid-java, qpid-jca'
--boolean_query='flagtypes.name-substring-mrg-2.4.0 &
flagtypes.name-notsubstring-mrg-2.4.0-'
</cli>
When I try to use the following, I receive a malformed boolean error.
<code>
bz_boolean = 'flagtypes.name-substring-mrg-2.4.0 &
flagtypes.name-notsubstring-mrg-2.4.0-'
bz = bugzilla.Bugzilla(url = bzurl)
query_in = bz.build_query(
product = "Red Hat Enterprise MRG",
component = MRGM,
boolean_query = bz_boolean)
query_out = bz.query(query_in)
for i in query_out:
print i
</code>
RuntimeError: Malformed boolean query: flagtypes.name-substring-mrg-2.4.0 &
flagtypes.name-notsubstring-mrg-2.4.0-
What am I doing wrong here or is it possible there is a bug in the library?
Also, I see that there is a option to use 'flag' for boolean search;
however, there is no example of how to do this. Is there possibly a way to
translate the the boolean query I'm attempting into a flag query?
Thanks!
Eric
10 years, 11 months
email from author of a comment
by Pierre-Yves Chibon
Hi,
Some release ago I was able to retrieve the email address of the person
that made a comment on a bug.
I was using this feature in fedora-active-user [1] to retrieve the dates
of the last comments of someone on the bugzilla.
For at least two releases I haven't been able to do this. I've looked at
the options but all I could find is the author's name, no email.
The question is then, can the email be accessed and I missed it, or has
it been removed?
Regards,
Pierre
[1] https://github.com/pypingou/fedora-active-user
10 years, 11 months
[PATCH] bugzilla: use passed in cookies correctly
by Don Zickus
When using the option --cookiefile for bugzilla, the cookiefile
override happens to late. Use the passed in file during the
beginning of init.
This is addressed by defaulting the cookiefile to None to simplify
the passed in argument code. Then the Bugzilla init routine assigns
the default of ~/.bugzillacookies if cookiefile is None.
This shouldn't affect any of the other scripts that do not use the
cookiefile as an arg.
Reported-by: Jan Pokorný <jpokorny(a)redhat.com>
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
---
bin/bugzilla | 11 ++++-------
bugzilla/base.py | 5 +++--
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/bin/bugzilla b/bin/bugzilla
index cd518c0..d6ba8cf 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -94,7 +94,7 @@ def setup_parser():
help="username")
p.add_option('--password',
help="password")
- p.add_option('--cookiefile',
+ p.add_option('--cookiefile', default=None,
help="cookie file to use for bugzilla authentication")
p.add_option('--verbose', action='store_true',
help="give more info about what's going on")
@@ -900,7 +900,7 @@ def main(bzinstance=None):
if bzinstance:
bz = bzinstance
else:
- bz = bzclass(url=global_opt.bugzilla)
+ bz = bzclass(url=global_opt.bugzilla, cookiefile=global_opt.cookiefile)
# Handle 'login' action
@@ -933,11 +933,8 @@ def main(bzinstance=None):
log.info('Using username/password for authentication')
bz.login(global_opt.user, global_opt.password)
elif not _is_unittest:
- if global_opt.cookiefile:
- bz.cookiefile = global_opt.cookiefile
- cookiefile = bz.cookiefile
- if os.path.exists(cookiefile):
- log.info('Using cookies in %s for authentication', cookiefile)
+ if os.path.exists(bz.cookiefile):
+ log.info('Using cookies in %s for authentication', bz.cookiefile)
else:
log.info('No authentication info provided.')
diff --git a/bugzilla/base.py b/bugzilla/base.py
index c2b9295..658fcc7 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -187,13 +187,14 @@ class BugzillaBase(object):
url = url + '/xmlrpc.cgi'
return url
- def __init__(self, url=None, user=None, password=None,
- cookiefile=os.path.expanduser('~/.bugzillacookies')):
+ def __init__(self, url=None, user=None, password=None, cookiefile=None):
# Settings the user might want to tweak
self.user = user or ''
self.password = password or ''
self.url = ''
+ if not cookiefile:
+ cookiefile = os.path.expanduser('~/.bugzillacookies')
self._cookiefobj = None
self._cookiejar = None
self._cookiefile = -1
--
1.7.1
10 years, 11 months
[PATCH V2] bugzilla: use passed in cookies correctly
by Don Zickus
When using the option --cookiefile for bugzilla, the cookiefile
override happens to late. Use the passed in file during the
beginning of init.
This is addressed by defaulting the cookiefile to None to simplify
the passed in argument code. Then the Bugzilla init routine assigns
the default of ~/.bugzillacookies if cookiefile is None.
This shouldn't affect any of the other scripts that do not use the
cookiefile as an arg.
V2: switch default from None to '' as None means use tempfile
Reported-by: Jan Pokorný <jpokorny(a)redhat.com>
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
---
bin/bugzilla | 11 ++++-------
bugzilla/base.py | 5 +++--
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/bin/bugzilla b/bin/bugzilla
index cd518c0..190f9db 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -94,7 +94,7 @@ def setup_parser():
help="username")
p.add_option('--password',
help="password")
- p.add_option('--cookiefile',
+ p.add_option('--cookiefile', default='',
help="cookie file to use for bugzilla authentication")
p.add_option('--verbose', action='store_true',
help="give more info about what's going on")
@@ -900,7 +900,7 @@ def main(bzinstance=None):
if bzinstance:
bz = bzinstance
else:
- bz = bzclass(url=global_opt.bugzilla)
+ bz = bzclass(url=global_opt.bugzilla, cookiefile=global_opt.cookiefile)
# Handle 'login' action
@@ -933,11 +933,8 @@ def main(bzinstance=None):
log.info('Using username/password for authentication')
bz.login(global_opt.user, global_opt.password)
elif not _is_unittest:
- if global_opt.cookiefile:
- bz.cookiefile = global_opt.cookiefile
- cookiefile = bz.cookiefile
- if os.path.exists(cookiefile):
- log.info('Using cookies in %s for authentication', cookiefile)
+ if os.path.exists(bz.cookiefile):
+ log.info('Using cookies in %s for authentication', bz.cookiefile)
else:
log.info('No authentication info provided.')
diff --git a/bugzilla/base.py b/bugzilla/base.py
index c2b9295..e90c18a 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -187,13 +187,14 @@ class BugzillaBase(object):
url = url + '/xmlrpc.cgi'
return url
- def __init__(self, url=None, user=None, password=None,
- cookiefile=os.path.expanduser('~/.bugzillacookies')):
+ def __init__(self, url=None, user=None, password=None, cookiefile=None):
# Settings the user might want to tweak
self.user = user or ''
self.password = password or ''
self.url = ''
+ if cookiefile is '':
+ cookiefile = os.path.expanduser('~/.bugzillacookies')
self._cookiefobj = None
self._cookiejar = None
self._cookiefile = -1
--
1.7.1
10 years, 11 months
[PATCH] bugzilla: honor --cookiefile early so "login" follows it
by Jan Pokorný
So far, ~/.bugzillacookies was a cookie holder regardless of what
cookiefile was specified together with "login" command.
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
---
bin/bugzilla | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bin/bugzilla b/bin/bugzilla
index cd518c0..53ab39b 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -900,7 +900,10 @@ def main(bzinstance=None):
if bzinstance:
bz = bzinstance
else:
- bz = bzclass(url=global_opt.bugzilla)
+ # mapping: constructor keyword -> source global_opt attribute
+ kws = {'url': 'bugzilla', 'cookiefile': 'cookiefile'}
+ kwfull = ((kw, getattr(global_opt, a, None)) for kw, a in kws.items())
+ bz = bzclass(**dict(filter(lambda (a, b): b, kwfull)))
# Handle 'login' action
--
1.8.1.4
10 years, 11 months