[python-bugzilla] [PATCH 1/2] post_translation is called twice on query
Don Zickus
dzickus at redhat.com
Thu Mar 21 18:25:46 UTC 2013
I have been fighting with python bugzilla 0.7.0 and 0.8.0 environments for
awhile. Recently I noticed the rhbz_back_compat flag that would help unify
them until everything is straightened out upstream.
However, setting rhbz_back_compat to True caused my scripts which use 'flags'
to fail. The reason is the bugzilla.query command.
After querying for a list of bugs, they get post_translated and then returned
to the query command. The query command the re-initializes the the bugs with a
_Bug object which causes the post_translated bugs to be re-post_translated
again. This causes a fault with the 'flags' attribute as it goes from a list to a
string. :-(
The flow is:
bugzilla/base.py::query()
self._query
bugzilla/rhbugzilla.py::_query()
self.post_translation()
return [_Bug(...]
bugzilla/bug.py::__init__
self._update_dict()
self.bugzilla.post_translation()
^^^^OOPS
I don't know the reason the post_translation moved to begin with, but I am just
moving it back to where it was for now. This fixes my 'flags' issue.
Signed-off-by: Don Zickus <dzickus at redhat.com>
---
bugzilla/bug.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bugzilla/bug.py b/bugzilla/bug.py
index 654d9a9..24bbc59 100644
--- a/bugzilla/bug.py
+++ b/bugzilla/bug.py
@@ -123,6 +123,7 @@ class _Bug(object):
# Use post_translation to convert getbug results to back compat values
q = {}
q["id"] = str(self.bug_id)
+ self.bugzilla.post_translation(q, r)
self._update_dict(r)
@@ -131,7 +132,6 @@ class _Bug(object):
Update internal dictionary, in a way that ensures no duplicate
entries are stored WRT field aliases
'''
- self.bugzilla.post_translation({}, newdict)
for newname, oldname in self.bugzilla.field_aliases:
if not oldname in newdict:
--
1.7.1
More information about the python-bugzilla
mailing list