Fix bug introduced in previous commit

This commit is contained in:
Nick Hall 2017-02-23 22:39:30 +00:00
parent 7b578356fd
commit 74ffc76af0

View File

@ -114,14 +114,14 @@ def diff_dbs(db1, db2, user):
handle_func1 = db1.get_table_metadata(item)["handle_func"]
handle_func2 = db2.get_table_metadata(item)["handle_func"]
handles1 = sorted([handle for handle in db1.handles_func1()])
handles2 = sorted([handle for handle in db2.handles_func2()])
handles1 = sorted([handle for handle in handles_func1()])
handles2 = sorted([handle for handle in handles_func2()])
p1 = 0
p2 = 0
while p1 < len(handles1) and p2 < len(handles2):
if handles1[p1] == handles2[p2]: # in both
item1 = db1.handle_func1(handles1[p1])
item2 = db2.handle_func2(handles2[p2])
item1 = handle_func1(handles1[p1])
item2 = handle_func2(handles2[p2])
diff = diff_items(item, to_struct(item1), to_struct(item2))
if diff:
diffs += [(item, item1, item2)]
@ -129,19 +129,19 @@ def diff_dbs(db1, db2, user):
p1 += 1
p2 += 1
elif handles1[p1] < handles2[p2]: # p1 is mssing in p2
item1 = db1.handle_func1(handles1[p1])
item1 = handle_func1(handles1[p1])
missing_from_new += [(item, item1)]
p1 += 1
elif handles1[p1] > handles2[p2]: # p2 is mssing in p1
item2 = db2.handle_func2(handles2[p2])
item2 = handle_func2(handles2[p2])
missing_from_old += [(item, item2)]
p2 += 1
while p1 < len(handles1):
item1 = db1.handle_func1(handles1[p1])
item1 = handle_func1(handles1[p1])
missing_from_new += [(item, item1)]
p1 += 1
while p2 < len(handles2):
item2 = db2.handle_func2(handles2[p2])
item2 = handle_func2(handles2[p2])
missing_from_old += [(item, item2)]
p2 += 1
return diffs, missing_from_old, missing_from_new