News feed should load properly for users who don't have items to load

This commit is contained in:
Manuel Cortez 2016-03-28 05:19:08 -06:00
parent f1040d0c5d
commit c3b66de713

View File

@ -202,7 +202,7 @@ class vkSession(object):
response = self.vk.client.wall.post(message=message, *args, **kwargs)
def get_newsfeed(self, name="newsfeed", show_nextpage=False, endpoint="", *args, **kwargs):
if show_nextpage == True:
if show_nextpage == True and self.db[name].has_key("cursor"):
kwargs["start_from"] = self.db[name]["cursor"]
print kwargs
data = getattr(self.vk.client.newsfeed, "get")(*args, **kwargs)
@ -213,6 +213,7 @@ class vkSession(object):
# print data.keys(), len(data["items"]), data["next_from"]
num = self.order_buffer(name, data["items"], show_nextpage)
print data.keys()
if data.has_key("next_from"):
self.db[name]["cursor"] = data["next_from"]
return num