Fix for lp:1294983. Added test for bools_are_tristate when processing rules for bool fields.

This commit is contained in:
Gregory Riker 2014-03-20 04:58:48 -07:00
parent 48c0a77c53
commit c951290eb4

View File

@ -584,10 +584,11 @@ class CatalogBuilder(object):
if field_contents == '': if field_contents == '':
field_contents = None field_contents = None
if (self.db.metadata_for_field(rule['field'])['datatype'] == 'bool' and # Handle condition where bools_are_tristate is False,
# field is a bool and contents is None, which is displayed as No
if (not self.db.prefs.get('bools_are_tristate') and
self.db.metadata_for_field(rule['field'])['datatype'] == 'bool' and
field_contents is None): field_contents is None):
# Handle condition where field is a bool and contents is None,
# which is displayed as No
field_contents = _('False') field_contents = _('False')
if field_contents is not None: if field_contents is not None:
@ -1021,8 +1022,11 @@ class CatalogBuilder(object):
data = self.plugin.search_sort_db(self.db, self.opts) data = self.plugin.search_sort_db(self.db, self.opts)
data = self.process_exclusions(data) data = self.process_exclusions(data)
if self.prefix_rules and self.DEBUG: if self.DEBUG:
self.opts.log.info(" Added prefixes:") if self.prefix_rules:
self.opts.log.info(" Added prefixes (bools_are_tristate: {0}):".format(self.db.prefs.get('bools_are_tristate')))
else:
self.opts.log.info(" No added prefixes")
# Populate this_title{} from data[{},{}] # Populate this_title{} from data[{},{}]
titles = [] titles = []