Merge pull request #112 from sam-m888/fixNonecomparisons
Don't use equality to check None
This commit is contained in:
commit
dc486bc79f
@ -644,7 +644,7 @@ def model_to_text(model, cols=None, treeiter=None, indent="",
|
||||
text = ""
|
||||
if treeiter is None:
|
||||
treeiter = model.get_iter_first()
|
||||
while treeiter != None:
|
||||
while treeiter is not None:
|
||||
if cols is None:
|
||||
items = sep.join([str(item) for item in model[treeiter][:]])
|
||||
else:
|
||||
|
@ -854,7 +854,7 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
|
||||
See Gtk.TreeModel
|
||||
"""
|
||||
#print 'do_iter_nth_child', iter, nth
|
||||
if iter == None:
|
||||
if iter is None:
|
||||
return True, self.node_map.get_iter(nth)
|
||||
return False, None
|
||||
|
||||
|
@ -104,7 +104,7 @@ class Node(object):
|
||||
"""
|
||||
Assign the handle of a Gramps object to this node.
|
||||
"""
|
||||
if not self.handle or handle == None:
|
||||
if not self.handle or handle is None:
|
||||
self.handle = handle
|
||||
self.secondary = secondary
|
||||
else:
|
||||
|
@ -162,7 +162,7 @@ def make_requested_gramplet(gui_class, pane, opts, dbstate, uistate):
|
||||
"""
|
||||
Make a GUI gramplet given its name.
|
||||
"""
|
||||
if opts == None:
|
||||
if opts is None:
|
||||
return None
|
||||
|
||||
if "name" in opts:
|
||||
|
@ -1819,7 +1819,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
txn.delete(sname)
|
||||
if group is not None:
|
||||
txn.put(sname, group)
|
||||
if group == None:
|
||||
if group is None:
|
||||
grouppar = ''
|
||||
else:
|
||||
grouppar = group
|
||||
@ -2649,7 +2649,7 @@ def write_lock_file(name):
|
||||
if win():
|
||||
user = get_env_var('USERNAME')
|
||||
host = get_env_var('USERDOMAIN')
|
||||
if host == None:
|
||||
if host is None:
|
||||
host = ""
|
||||
else:
|
||||
host = os.uname()[1]
|
||||
|
@ -1395,7 +1395,7 @@ if __name__ == '__main__':
|
||||
print("#None are known")
|
||||
tmp = main_level_test(consume_str, NameFormat, name_to_test)
|
||||
print(tmp)
|
||||
print("Good" if tmp == None else "!! bad !!")
|
||||
print("Good" if tmp is None else "!! bad !!")
|
||||
|
||||
|
||||
print()
|
||||
|
@ -963,9 +963,9 @@ class WebCalReport(Report):
|
||||
continue
|
||||
for day in vals:
|
||||
event_date = "%04d%02d%02d" % (year, month, day)
|
||||
if evdte == None:
|
||||
if evdte is None:
|
||||
evdte = event_date
|
||||
elif nxt == None:
|
||||
elif nxt is None:
|
||||
nxt = event_date
|
||||
self.event_list.append((evdte, prv, nxt))
|
||||
else:
|
||||
@ -1254,7 +1254,7 @@ class WebCalReport(Report):
|
||||
prefix = self.narweb_prefix)))
|
||||
else:
|
||||
text = short_name
|
||||
if age_at_death == None:
|
||||
if age_at_death is None:
|
||||
self.add_day_item(text, year, month, day, 'Birthday', age_at_death, birth_date)
|
||||
else:
|
||||
self.add_day_item(text, year, month, day, 'Birthday', age_at_death, person_death)
|
||||
|
Loading…
Reference in New Issue
Block a user