bugzilla 4.4.4
by JiekeWu
hello, everyone,
I have a system to create bug automatically, using python-bugzilla 0.7 and bugzilla 4.2.5 on Centos 6.
recently, I upgrade bugzilla to 4.4.4, and find /usr/bin/bugziila 0.7 is not working.
error like that:
Fault: <Fault 32000: u"A value must be set for the '\u7c7b\u578b' field.">
So I upgrade python-bugzilla to latest one, git commit:
commit e3f17d7db5907ea629f31fbc892576fdf9ccec4e
Author: Josef Stribny <jstribny(a)redhat.com>
Date: Tue Jun 3 15:27:08 2014 +0200
error is changed as:
Traceback (most recent call last):
File "/usr/bin/bugzilla", line 1250, in <module>
main()
File "/usr/bin/bugzilla", line 1222, in main
buglist = _do_new(bz, opt)
File "/usr/bin/bugzilla", line 900, in _do_new
b = bz.createbug(ret)
File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 1613, in createbug
rawbug = self._proxy.Bug.create(data)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 165, in _ServerProxy__request
ret = ServerProxy._ServerProxy__request(self, methodname, params)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 260, in request
return self._request_helper(url, request_body)
File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 247, in _request_helper
raise e
BugzillaError: 'ascii' codec can't encode characters in position 149-153: ordinal not in range(128)
Server error: 'ascii' codec can't encode characters in position 149-153: ordinal not in range(128)
any suggestions? and do you have a plan to support 4.4.4?.
--
Thanks.
9 years, 10 months
[PATCH] Fix for writing tokenfile on python3
by Leif Gruenwoldt
The tokenfile must be opened in text mode to avoid an error on write:
TypeError: 'str' does not support the buffer interface
https://docs.python.org/3/library/configparser.html#configparser.ConfigPa...
Tested on Python 3.4.1.
---
bugzilla/base.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bugzilla/base.py b/bugzilla/base.py
index ca107b4..84d4be3 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -135,7 +135,7 @@ class _BugzillaToken(object):
self.tokenfile.set(self.domain, 'token', value)
if self.tokenfilename:
- with open(self.tokenfilename, 'wb') as tokenfile:
+ with open(self.tokenfilename, 'w') as tokenfile:
log.debug("Saving to tokenfile")
self.tokenfile.write(tokenfile)
--
1.9.0.msysgit.0
9 years, 10 months
ANNOUNCE: python-bugzilla 1.1.0 released
by Cole Robinson
I'm happy to announce a new release of python-bugzilla, version 1.1.0.
python-bugzilla is a library and commandline tool for interacting with
a bugzilla instance, including querying, modifying, and creating bug reports.
The release can be downloaded from:
https://fedorahosted.org/released/python-bugzilla/python-bugzilla-1.1.0.t...
This release includes:
- Support for bugzilla tokens (Arun Babu Nelicattu)
- bugzilla: Add query/modify --tags
- bugzilla --login: Allow to login and run a command in one shot
- bugzilla --no-cache-credentials: Don't use or save cached credentials
when using the CLI
- Show bugzilla errors when login fails
- Don't pull down attachments in bug.refresh(), need to get
bug.attachments manually
- Add Bugzilla bug_autorefresh parameter.
Some of these changes deserve a bit more explanation:
* Bugzilla tokens
Sometime later in the year, bugzilla.redhat.com will be updated to a new
version of bugzilla that replaces API cookie authentication with a non-cookie
token system. I don't fully understand the reasoning so don't ask :)
Regardless, this release supports the new token infrastructure along side the
existing cookie handling.
Users shouldn't notice any difference: we cache the token in ~/.bugzillatoken
so things work the same as the current cookie auth.
If you use cookiefile=None in the API to tell bugzilla _not_ to cache any
login credentials, you will now also want to specify tokenfile=None (hint hint
fedora infrastructure).
* bugzilla --login and bugzilla --no-cache-credentials
Right now the only way to perform an authenticated bugzilla command on a new
machine requires running a one time 'bugzilla login' to cache credentials
before running the desired command.
Now you can just do 'bugzilla --login <cmd>' and the login process will be
initiated before invoking the command.
Additionally, the --no-cache-credentials option will tell the bugzilla tool to
_not_ save any credentials to ~/.bugzillacookies or ~/.bugzillatoken.
* Bugzilla.bug_autorefresh
When interacting with a Bug object, if you attempt to access a property (say,
bugobj.component) that hasn't already been fetched from the bugzilla instance,
python-bugzilla will do an automatic 'refresh'/getbug to pull down every
property for said bug in an attempt to satisfy the request.
This is convenient for a one off API invocation, but for recurring scripts
this is a waste of time and bugzilla bandwidth. The autorefresh can be avoided
by passing a properly formatted include_fields to your query request, where
include_fields contains every Bug property you will access in your script.
However it's still quite easy to extend a script with a new property usage and
forget to adjust include_fields. Things will continue to work due to the
autorefresh feature but your script will be far slower and wasteful.
A new Bugzilla property has been added, bug_autorefresh. Set this to False to
disable the autorefresh feature for newly fetched bugs. This will cause an
explicit error to be raised if your code is depending on autorefresh.
Please consider setting this property for your recurring scripts. Example:
bzapi = Bugzilla("bugzilla.redhat.com")
bzapi.bug_autorefresh = False
...
autorefresh can be disabled for individual bugs with:
bug.autorefresh = False
Thanks to everyone who has contributed to this release through testing,
bug reporting, submitting patches, and otherwise sending in feedback!
Thanks,
Cole
9 years, 11 months
[Patch] Fix ability to not save session cookies to disk
by Toshio Kuratomi
The switch to requests in python-bugzilla seems to have broken the ability
to use python-bugzilla without a persistent cookie store. The configuration
of requests in the code is telling requests not to use cookies at all when
what we want is just for requests to not save the cookies to a file on disk.
The attached patch should fix that.
-Toshio
9 years, 11 months