@@ -580,8 +580,11 @@ def logged_in(self):
580580 #############################################
581581
582582 def _getbugfields (self ):
583- raise RuntimeError ("This bugzilla version does not support listing "
584- "bug fields." )
583+ '''
584+ Get the list of valid fields for Bug objects
585+ '''
586+ r = self ._proxy .Bug .fields ({'include_fields' : ['name' ]})
587+ return [f ['name' ] for f in r ['fields' ]]
585588
586589 def getbugfields (self , force_refresh = False ):
587590 '''
@@ -993,7 +996,8 @@ def build_query(self,
993996 savedsearch = None ,
994997 savedsearch_sharer_id = None ,
995998 sub_component = None ,
996- tags = None ):
999+ tags = None ,
1000+ exclude_fields = None ):
9971001 """
9981002 Build a query string from passed arguments. Will handle
9991003 query parameter differences between various bugzilla versions.
@@ -1007,9 +1011,10 @@ def build_query(self,
10071011
10081012 Then pass the output to Bugzilla.query()
10091013 """
1014+ # These parameters are only used by RHBugzilla, which overwrites
1015+ # this implementation. So ignore them here
10101016 ignore = emailtype
10111017 ignore = booleantype
1012- ignore = include_fields
10131018
10141019 for key , val in [
10151020 ('fixed_in' , fixed_in ),
@@ -1054,6 +1059,18 @@ def build_query(self,
10541059 "tag" : self ._listify (tags ),
10551060 }
10561061
1062+ # 'include_fields' only available for Bugzilla4+
1063+ if self ._check_version (4 , 0 ):
1064+ include_fields = self ._convert_include_field_list (include_fields )
1065+ if include_fields :
1066+ if 'id' not in include_fields :
1067+ include_fields .append ('id' )
1068+ query ["include_fields" ] = include_fields
1069+
1070+ exclude_fields = self ._convert_include_field_list (exclude_fields )
1071+ if exclude_fields :
1072+ query ["exclude_fields" ] = exclude_fields
1073+
10571074 # Strip out None elements in the dict
10581075 for k , v in query .copy ().items ():
10591076 if v is None :
0 commit comments