From 70d50d2fc2d51cf0f74e6043ad898952d4623502 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Wed, 7 Nov 2012 21:20:24 +0000 Subject: [PATCH] python 3 support: fixes, no longer maxint, missing sys import, next change by 2to3 svn: r20637 --- gramps/gen/db/backup.py | 2 +- gramps/gen/db/write.py | 2 +- gramps/gui/views/treemodels/flatbasemodel.py | 1 + gramps/plugins/lib/libgrdb.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gramps/gen/db/backup.py b/gramps/gen/db/backup.py index 0f4ddf87c..adc511c6d 100644 --- a/gramps/gen/db/backup.py +++ b/gramps/gen/db/backup.py @@ -133,7 +133,7 @@ def __do_export(database): data = cursor.first() while data: pickle.dump(data, backup_table, 2) - data = next(cursor) + data = cursor.next() cursor.close() backup_table.close() except (IOError,OSError): diff --git a/gramps/gen/db/write.py b/gramps/gen/db/write.py index 2757c80b8..ace6d373f 100644 --- a/gramps/gen/db/write.py +++ b/gramps/gen/db/write.py @@ -1182,7 +1182,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): def create_id(self): return "%08x%08x" % ( int(time.time()*10000), - self.rand.randint(0, maxint)) + self.rand.randint(0, maxsize)) def __add_object(self, obj, transaction, find_next_func, commit_func): if find_next_func and not obj.gramps_id: diff --git a/gramps/gui/views/treemodels/flatbasemodel.py b/gramps/gui/views/treemodels/flatbasemodel.py index 0fbdc8038..08b7effe6 100644 --- a/gramps/gui/views/treemodels/flatbasemodel.py +++ b/gramps/gui/views/treemodels/flatbasemodel.py @@ -56,6 +56,7 @@ from __future__ import print_function import logging import bisect +import sys import time _LOG = logging.getLogger(".gui.basetreemodel") diff --git a/gramps/plugins/lib/libgrdb.py b/gramps/plugins/lib/libgrdb.py index 7f762802a..e6a5f854b 100644 --- a/gramps/plugins/lib/libgrdb.py +++ b/gramps/plugins/lib/libgrdb.py @@ -324,7 +324,7 @@ class DbGrdb(Callback): def create_id(self): return "%08x%08x" % ( int(time.time()*10000), - self.rand.randint(0, maxint)) + self.rand.randint(0, maxsize)) def get_person_cursor(self): raise NotImplementedError