Fixed a bug with database and put_items_on_list

This commit is contained in:
Manuel Cortez 2016-08-06 14:09:27 -05:00
parent 47b8575f55
commit 7bc26a94c7

View File

@ -364,7 +364,7 @@ class baseBufferController(bufferController):
self.remove_item(i) self.remove_item(i)
def put_items_on_list(self, number_of_items): def put_items_on_list(self, number_of_items):
if number_of_items == 0: return if number_of_items == 0 and self.session.settings["general"]["persist_size"] == 0: return
log.debug("The list contains %d items " % (self.buffer.list.get_count(),)) log.debug("The list contains %d items " % (self.buffer.list.get_count(),))
log.debug("Putting %d items on the list" % (number_of_items,)) log.debug("Putting %d items on the list" % (number_of_items,))
if self.buffer.list.get_count() == 0: if self.buffer.list.get_count() == 0:
@ -372,7 +372,7 @@ class baseBufferController(bufferController):
tweet = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"]) tweet = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"])
self.buffer.list.insert_item(False, *tweet) self.buffer.list.insert_item(False, *tweet)
self.buffer.set_position(self.session.settings["general"]["reverse_timelines"]) self.buffer.set_position(self.session.settings["general"]["reverse_timelines"])
elif self.buffer.list.get_count() > 0: elif self.buffer.list.get_count() > 0 and number_of_items > 0:
if self.session.settings["general"]["reverse_timelines"] == False: if self.session.settings["general"]["reverse_timelines"] == False:
items = self.session.db[self.name][len(self.session.db[self.name])-number_of_items:] items = self.session.db[self.name][len(self.session.db[self.name])-number_of_items:]
for i in items: for i in items: