From 9e5f899bbd529c27e2ab3210ec28a25b82c4bc2c Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 23 Sep 2016 10:39:15 -0400 Subject: [PATCH] 9710: dbapi pylint issues, adjustment --- gramps/plugins/db/dbapi/dbapi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gramps/plugins/db/dbapi/dbapi.py b/gramps/plugins/db/dbapi/dbapi.py index 20027d885..e6b71324a 100644 --- a/gramps/plugins/db/dbapi/dbapi.py +++ b/gramps/plugins/db/dbapi/dbapi.py @@ -443,16 +443,22 @@ class DBAPI(DbGeneric): txn.last = None self._after_commit(txn) - def get_metadata(self, key, default=None): + def get_metadata(self, key, default=[]): """ Get an item from the database. + + Default is an empty list, which is a mutable and + thus a bad default (pylint will complain). + + However, it is just used as a value, and not altered, so + its use here is ok. """ self.dbapi.execute( "SELECT value FROM metadata WHERE setting = ?;", [key]) row = self.dbapi.fetchone() if row: return pickle.loads(row[0]) - elif default == None: + elif default == []: return [] else: return default