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 # Search through characters between the brackets
for char in str_val[1:-1]: 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 # This character starts a string
quote_type = char quote_type = char
elif char == quote_type: elif char == quote_type:
# This character ends a string # This character ends a string
quote_type = None quote_type = None
elif quote_type == None and char == ",": elif quote_type is None and char == ",":
# This character ends an entry # This character ends an entry
ret_val.append(entry.strip()) ret_val.append(entry.strip())
entry = "" entry = ""

View File

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

View File

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

View File

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

View File

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

View File

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