tweak some None tests

This commit is contained in:
Paul Franklin 2017-05-07 18:03:40 -07:00
parent 49493290c5
commit c8001c7483
6 changed files with 12 additions and 9 deletions

View File

@ -120,13 +120,13 @@ def _convert_str_to_match_type(str_val, type_val):
# Search through characters between the brackets
for char in str_val[1:-1]:
if (char == "'" or char == '"') and quote_type == None:
if (char == "'" or char == '"') and quote_type is None:
# This character starts a string
quote_type = char
elif char == quote_type:
# This character ends a string
quote_type = None
elif quote_type == None and char == ",":
elif quote_type is None and char == ",":
# This character ends an entry
ret_val.append(entry.strip())
entry = ""

View File

@ -107,10 +107,11 @@ class Calendar(Report):
self.text3 = get_value('text3')
self.filter_option = menu.get_option_by_name('filter')
self.filter = self.filter_option.get_filter()
pid = get_value('pid')
self.center_person = self.database.get_person_from_gramps_id(pid)
if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
self.set_locale(get_value('trans'))

View File

@ -629,7 +629,7 @@ class ConsumableString:
def __get_a_char_of_text(self):
""" Removes one char of TEXT from the string and returns it. """
if self.this == "\\":
if self.next == None:
if self.next is None:
rtrn = "\\"
else:
rtrn = self.next

View File

@ -107,10 +107,11 @@ class AncestorReport(Report):
self.max_generations = menu.get_option_by_name('maxgen').get_value()
self.pgbrk = menu.get_option_by_name('pagebbg').get_value()
self.opt_namebrk = menu.get_option_by_name('namebrk').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)

View File

@ -107,8 +107,8 @@ class BirthdayReport(Report):
stdoptions.run_name_format_option(self, menu)
self.center_person = self.database.get_person_from_gramps_id(pid)
if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid )
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
def get_name(self, person, maiden_name = None):
"""

View File

@ -435,6 +435,7 @@ class DescendantReport(Report):
self.database = CacheProxyDb(self.database)
self.max_generations = menu.get_option_by_name('gen').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None: