From 3a5eeed372334c9fef8966bb16a31b47fb6e5ab3 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Sat, 2 May 2015 04:00:29 -0400 Subject: [PATCH] Announce to user on database shelve, the process can take a while especially with large dictionaries and slow systems and we don't want users thinking the app hung. --- src/sessionmanager/session.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 58545fae..56eea38e 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -365,10 +365,12 @@ class Session(object): "Shelve the database to allow for persistance." shelfname=paths.config_path(str(self.session_id)+".db") try: + if not os.exists(shelfname): + output.speak("Generating database, this might take a while.",True) shelf=shelve.open(paths.config_path(shelfname),'c') for key,value in self.db.items(): if type(key) != str and type(key) != unicode: - output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.") + output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True) log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!") shelf[str(key)]=value shelf.close()