From a72c6eac96a41b08631cfcb5a559d226611a6bb1 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Mon, 23 Dec 2013 15:19:18 -0500 Subject: [PATCH] Don't go through loop if not Python 3; fixed typo --- gramps/gen/db/write.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gramps/gen/db/write.py b/gramps/gen/db/write.py index 94cfd93da..40f8e9a04 100644 --- a/gramps/gen/db/write.py +++ b/gramps/gen/db/write.py @@ -1281,11 +1281,12 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): """ if isinstance(key, tuple): #create a byte string key, first validity check in python 3! - for val in key: - if sys.version_info[0] >= 3 and isinstance(val, bytes): - raise DbError(_('An attempt is made to safe a reference key ' - 'which is partly bytecode, this is not allowed.\n' - 'Key is %s') % str(key)) + if sys.version_info[0] >= 3: + for val in key: + if isinstance(val, bytes): + raise DbError(_('An attempt is made to save a reference key ' + 'which is partly bytecode, this is not allowed.\n' + 'Key is %s') % str(key)) key = str(key) if isinstance(key, UNITYPE): key = key.encode('utf-8')