Handle people with legacy databases that have custom columns with non ascii search names. Fixes #781490 (KeyError happens whenever I click on a book in the main screen (list))

This commit is contained in:
Kovid Goyal 2011-05-12 09:07:29 -06:00
parent 8c6c5c668f
commit da90da98e3

View File

@ -112,10 +112,15 @@ class Metadata(object):
Be careful with numeric fields since this will return True for zero as
well as None.
Also returns True if the field does not exist.
'''
try:
null_val = NULL_VALUES.get(field, None)
val = getattr(self, field, None)
return not val or val == null_val
except:
return True
def __getattribute__(self, field):
_data = object.__getattribute__(self, '_data')