diff --git a/src/controller/buffersController.py b/src/controller/buffersController.py index 6ecc2b82..496b7279 100644 --- a/src/controller/buffersController.py +++ b/src/controller/buffersController.py @@ -457,7 +457,7 @@ class baseBufferController(bufferController): self.session.sound.play("audio.ogg") if utils.is_geocoded(tweet): self.session.sound.play("geo.ogg") -# self.session.db[str(self.name+"_pos")]=self.buffer.list.get_selected() + self.session.db[self.name+"_pos"]=self.buffer.list.get_selected() @_tweets_exist def audio(self,url=''): diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 6f7c7889..7d4df8b1 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -381,10 +381,11 @@ class Session(object): 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.",True) log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!") + # Convert unicode objects to UTF-8 strings before shelve these objects. if type(value) == list and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]: - shelf[str(key)]=value[self.settings["general"]["persist_size"]:] + shelf[str(key.encode("utf-8"))]=value[self.settings["general"]["persist_size"]:] else: - shelf[str(key)]=value + shelf[str(key.encode("utf-8"))]=value shelf.close() except: output.speak("An exception occurred while shelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True) @@ -401,7 +402,7 @@ class Session(object): try: shelf=shelve.open(paths.config_path(shelfname),'c') for key,value in shelf.items(): - self.db[unicode(key)]=value + self.db[key]=value shelf.close() except: output.speak("An exception occurred while deshelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)