mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-04 03:27:00 -05:00 
			
		
		
		
	Fix for lp:1294983. Added test for bools_are_tristate when processing rules for bool fields.
This commit is contained in:
		
							parent
							
								
									48c0a77c53
								
							
						
					
					
						commit
						c951290eb4
					
				@ -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 = []
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user