From dc41dbb766b302a4893dbc95b1b52822ae9634d5 Mon Sep 17 00:00:00 2001 From: paulm Date: Thu, 10 Oct 2013 17:49:18 -0700 Subject: [PATCH 1/3] added getall method: returns list of all (top-level) keys --- pickledb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pickledb.py b/pickledb.py index 6110e18..30a5eb3 100644 --- a/pickledb.py +++ b/pickledb.py @@ -69,6 +69,10 @@ def get(self, key): except KeyError: return None + def getall(self): + '''return a list of all the keys''' + return self.db.keys() + def rem(self, key): '''Delete a key''' del self.db[key] From 8de50dc84a618b83cd8f6e10ac2a13265b5fe6d4 Mon Sep 17 00:00:00 2001 From: paulm Date: Thu, 10 Oct 2013 18:05:55 -0700 Subject: [PATCH 2/3] in self.load location = os.path.exanduser(location) so we can expand paths without failing silently --- pickledb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pickledb.py b/pickledb.py index 30a5eb3..98f5af8 100644 --- a/pickledb.py +++ b/pickledb.py @@ -43,6 +43,7 @@ def __init__(self, location, option): def load(self, location, option): '''Loads, reloads or changes the path to the db file. DO NOT USE this method has it may be deprecated in the future.''' + location = os,apth.expanduser(location) self.loco = location self.fsave = option if os.path.exists(location): @@ -185,7 +186,7 @@ def deldb(self): self._dumpdb(self.fsave) return True - def _loaddb(self): + def _loaddb(self) : '''Load or reload the json info from the file''' self.db = json.load(open(self.loco, 'rb')) From a1d6380963d34ceecf745675466583b7d0167dd5 Mon Sep 17 00:00:00 2001 From: paulm Date: Fri, 11 Oct 2013 10:21:42 -0700 Subject: [PATCH 3/3] typo fix --- pickledb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pickledb.py b/pickledb.py index 98f5af8..bff00b0 100644 --- a/pickledb.py +++ b/pickledb.py @@ -43,7 +43,7 @@ def __init__(self, location, option): def load(self, location, option): '''Loads, reloads or changes the path to the db file. DO NOT USE this method has it may be deprecated in the future.''' - location = os,apth.expanduser(location) + location = os.path.expanduser(location) self.loco = location self.fsave = option if os.path.exists(location):