partly revert 7470: Upgrade to db version 17 fails in Python3 due to use of iteritems
This commit is contained in:
parent
0618abf89c
commit
f3d993be38
@ -398,9 +398,14 @@ class FlatNodeMap(object):
|
|||||||
insert_pos = bisect.bisect_left(self._index2hndl, srtkey_hndl)
|
insert_pos = bisect.bisect_left(self._index2hndl, srtkey_hndl)
|
||||||
self._index2hndl.insert(insert_pos, srtkey_hndl)
|
self._index2hndl.insert(insert_pos, srtkey_hndl)
|
||||||
#make sure the index map is updated
|
#make sure the index map is updated
|
||||||
for hndl, index in self._hndl2index.items():
|
if sys.version_info[0] < 3: # keep this, for speed in Python2
|
||||||
if index >= insert_pos:
|
for hndl, index in self._hndl2index.iteritems(): # in Python2 "if"
|
||||||
self._hndl2index[hndl] += 1
|
if index >= insert_pos:
|
||||||
|
self._hndl2index[hndl] += 1
|
||||||
|
else:
|
||||||
|
for hndl, index in self._hndl2index.items():
|
||||||
|
if index >= insert_pos:
|
||||||
|
self._hndl2index[hndl] += 1
|
||||||
self._hndl2index[srtkey_hndl[1]] = insert_pos
|
self._hndl2index[srtkey_hndl[1]] = insert_pos
|
||||||
#update self.__corr so it remains correct
|
#update self.__corr so it remains correct
|
||||||
if self._reverse:
|
if self._reverse:
|
||||||
@ -442,9 +447,14 @@ class FlatNodeMap(object):
|
|||||||
if self._reverse:
|
if self._reverse:
|
||||||
self.__corr = (len(self._index2hndl) - 1, -1)
|
self.__corr = (len(self._index2hndl) - 1, -1)
|
||||||
#update the handle2path map so it remains correct
|
#update the handle2path map so it remains correct
|
||||||
for key, val in self._hndl2index.items():
|
if sys.version_info[0] < 3: # keep this, for speed in Python2
|
||||||
if val > index:
|
for key, val in self._hndl2index.iteritems(): # in Python2 "if"
|
||||||
self._hndl2index[key] -= 1
|
if val > index:
|
||||||
|
self._hndl2index[key] -= 1
|
||||||
|
else:
|
||||||
|
for key, val in self._hndl2index.items():
|
||||||
|
if val > index:
|
||||||
|
self._hndl2index[key] -= 1
|
||||||
return Gtk.TreePath((delpath,))
|
return Gtk.TreePath((delpath,))
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user