From b39ed42f677d9794471defeb30f446e4ffc1799a Mon Sep 17 00:00:00 2001 From: Till Maas Date: Mon, 7 Oct 2013 18:55:34 +0200 Subject: Adjust Bugzilla query to new release --- cnucnu/bugzilla_reporter.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/cnucnu/bugzilla_reporter.py b/cnucnu/bugzilla_reporter.py index 9b42d37..0ba055a 100644 --- a/cnucnu/bugzilla_reporter.py +++ b/cnucnu/bugzilla_reporter.py @@ -24,10 +24,13 @@ from helper import filter_dict import logging log = logging.getLogger('cnucnu.bugzilla_reporter') + class BugzillaReporter(object): - base_query = {'query_format': ['advanced'], 'emailreporter1': ['1'], 'emailtype1': ['exact']} + base_query = {'query_format': 'advanced', + 'emailreporter1': '1', 'emailtype1': 'exact'} - bug_status_open = ['NEW', 'ASSIGNED', 'MODIFIED', 'ON_DEV', 'ON_QA', 'VERIFIED', 'FAILS_QA', 'RELEASE_PENDING', 'POST'] + bug_status_open = ['NEW', 'ASSIGNED', 'MODIFIED', 'ON_DEV', 'ON_QA', + 'VERIFIED', 'FAILS_QA', 'RELEASE_PENDING', 'POST'] bug_status_closed = ['CLOSED'] new_bug = {} @@ -125,20 +128,20 @@ class BugzillaReporter(object): def get_exact_outdated_bug(self, package): short_desc_pattern = '%(name)s-%(latest_upstream)s ' % package - q = {'component': [package.name], - 'bug_status': self.bug_status_open + self.bug_status_closed, - 'short_desc': [short_desc_pattern], - 'short_desc_type': ['substring'] - } - - q.update(self.base_query) - logging.debug("get_exact_outdated_bug: Bugzilla query: %s", q) - bugs = self.bz.query(q) + query = {'component': package.name, + 'bug_status': self.bug_status_open + self.bug_status_closed, + 'short_desc': short_desc_pattern, + 'short_desc_type': 'substring'} + + query.update(self.base_query) + logging.debug("get_exact_outdated_bug: Bugzilla query: %s", query) + bugs = self.bz.query(query) if bugs: # TODO if more than one bug, manual intervention might be required for bug in bugs: - # The short_desc_pattern contains a space at the end, which is currently - # not recognized by bugzilla. Therefore this test is required: + # The short_desc_pattern contains a space at the end, which is + # currently not recognized by bugzilla. Therefore this test is + # required: if bug.short_desc.startswith(short_desc_pattern): return bug -- cgit