7470: Upgrade to db version 17 fails in Python 3 due to use of iteritems
This commit is contained in:
parent
8752d173af
commit
7346496214
@ -290,7 +290,7 @@ def upgrade_datamap_17(datamap):
|
|||||||
new_srcattr_list = []
|
new_srcattr_list = []
|
||||||
private = False
|
private = False
|
||||||
from ..lib.srcattrtype import SrcAttributeType
|
from ..lib.srcattrtype import SrcAttributeType
|
||||||
for (key, value) in datamap.iteritems():
|
for (key, value) in datamap.items():
|
||||||
the_type = SrcAttributeType(key).serialize()
|
the_type = SrcAttributeType(key).serialize()
|
||||||
new_srcattr_list.append((private, the_type, value))
|
new_srcattr_list.append((private, the_type, value))
|
||||||
return new_srcattr_list
|
return new_srcattr_list
|
||||||
|
@ -91,7 +91,7 @@ class HasPlace(Rule):
|
|||||||
"""
|
"""
|
||||||
Check each location for a match.
|
Check each location for a match.
|
||||||
"""
|
"""
|
||||||
for place_type, field in self.TYPE2FIELD.iteritems():
|
for place_type, field in self.TYPE2FIELD.items():
|
||||||
name = location.get(place_type, '')
|
name = location.get(place_type, '')
|
||||||
if not self.match_substring(field, name):
|
if not self.match_substring(field, name):
|
||||||
return False
|
return False
|
||||||
|
@ -398,11 +398,6 @@ 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
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
for hndl, index in self._hndl2index.iteritems():
|
|
||||||
if index >= insert_pos:
|
|
||||||
self._hndl2index[hndl] += 1
|
|
||||||
else:
|
|
||||||
for hndl, index in self._hndl2index.items():
|
for hndl, index in self._hndl2index.items():
|
||||||
if index >= insert_pos:
|
if index >= insert_pos:
|
||||||
self._hndl2index[hndl] += 1
|
self._hndl2index[hndl] += 1
|
||||||
@ -447,11 +442,6 @@ 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
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
for key, val in self._hndl2index.iteritems():
|
|
||||||
if val > index:
|
|
||||||
self._hndl2index[key] -= 1
|
|
||||||
else:
|
|
||||||
for key, val in self._hndl2index.items():
|
for key, val in self._hndl2index.items():
|
||||||
if val > index:
|
if val > index:
|
||||||
self._hndl2index[key] -= 1
|
self._hndl2index[key] -= 1
|
||||||
|
@ -2491,7 +2491,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
element_name = xml_element_name,
|
element_name = xml_element_name,
|
||||||
attrs = " ".join(
|
attrs = " ".join(
|
||||||
['{}="{}"'.format(k,escape(v, entities={'"' : """}))
|
['{}="{}"'.format(k,escape(v, entities={'"' : """}))
|
||||||
for k,v in xml_attrs.iteritems()]))
|
for k,v in xml_attrs.items()]))
|
||||||
# TRANSLATORS: leave the {date} and {xml} untranslated in the format string,
|
# TRANSLATORS: leave the {date} and {xml} untranslated in the format string,
|
||||||
# but you may re-order them if needed.
|
# but you may re-order them if needed.
|
||||||
LOG.warning(_("Invalid date {date} in XML {xml}, preserving XML as text"
|
LOG.warning(_("Invalid date {date} in XML {xml}, preserving XML as text"
|
||||||
|
Loading…
Reference in New Issue
Block a user