Skip to content

Commit 3f90169

Browse files
committed
bugzilla: Move query longdesc handling to general code
This was just a convenience wrapper for some query_format=advanced behavior, which is available for upstream bugzilla now, so move it to common code.
1 parent e504fc2 commit 3f90169

3 files changed

Lines changed: 9 additions & 16 deletions

File tree

bugzilla/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,6 @@ def build_query(self,
10641064
('devel_whiteboard', devel_whiteboard),
10651065
('alias', alias),
10661066
('boolean_query', boolean_query),
1067-
('long_desc', long_desc),
10681067
('quicksearch', quicksearch),
10691068
('savedsearch', savedsearch),
10701069
('sharer_id', savedsearch_sharer_id),
@@ -1098,6 +1097,11 @@ def build_query(self,
10981097
"tag": self._listify(tags),
10991098
}
11001099

1100+
if long_desc is not None:
1101+
query["query_format"] = "advanced"
1102+
query["longdesc"] = long_desc
1103+
query["longdesc_type"] = "allwordssubstr"
1104+
11011105
# 'include_fields' only available for Bugzilla4+
11021106
query.update(self._process_include_fields(
11031107
include_fields, exclude_fields, None))

bugzilla/rhbugzilla.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,6 @@ def _add_key(paramname, keyname, listify=False):
353353
val = self._listify(val)
354354
query[keyname] = val
355355

356-
def add_longdesc():
357-
val = kwargs.pop("long_desc", None)
358-
if val is None:
359-
return
360-
361-
query["query_format"] = "advanced"
362-
query["longdesc"] = val
363-
query["longdesc_type"] = "allwordssubstr"
364-
365356
def add_email(key, count):
366357
value = kwargs.pop(key, None)
367358
if value is None:
@@ -466,8 +457,6 @@ def make_bool_str(prefix):
466457
chart_id = add_boolean("alias", "alias", chart_id)
467458
chart_id = add_boolean("boolean_query", None, chart_id)
468459

469-
add_longdesc()
470-
471460
_add_key("quicksearch", "quicksearch")
472461
_add_key("savedsearch", "savedsearch")
473462
_add_key("savedsearch_sharer_id", "sharer_id")

tests/query.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ def testSubComponent(self):
144144
'http://example.com', 'bug_file_loc_type': 'foo'}
145145
_booleans_out = None
146146
_booleans_chart_out = None
147-
_longdesc_out = None
147+
_longdesc_out = {'longdesc': 'foobar', 'longdesc_type': 'allwordssubstr',
148+
'query_format': 'advanced'}
148149
_quicksearch_out = None
149150
_savedsearch_out = None
150151
_sub_component_out = None
@@ -193,6 +194,8 @@ class BZ4Test(BZ34Test):
193194
_keywords_out = BZ34Test._keywords_out.copy()
194195
_keywords_out["include_fields"] = _default_includes
195196

197+
_longdesc_out = BZ34Test._longdesc_out.copy()
198+
_longdesc_out["include_fields"] = _default_includes
196199

197200

198201
class RHBZTest(BZ4Test):
@@ -228,9 +231,6 @@ class RHBZTest(BZ4Test):
228231
'type0-1-0': 'notsubstring', 'value0-1-0': 'OtherQA',
229232
'include_fields': BZ4Test._default_includes,
230233
'query_format': 'advanced'}
231-
_longdesc_out = {'include_fields': BZ4Test._default_includes,
232-
'longdesc': 'foobar', 'longdesc_type': 'allwordssubstr',
233-
'query_format': 'advanced'}
234234
_quicksearch_out = {'include_fields': BZ4Test._default_includes,
235235
'quicksearch': 'foo bar baz'}
236236
_savedsearch_out = {'include_fields': BZ4Test._default_includes,

0 commit comments

Comments
 (0)