Fixed get previous item in newsfeed buffer. Now it should load around 700 items
This commit is contained in:
parent
6a8459cc4e
commit
fbada0c4be
@ -108,7 +108,7 @@ class baseBuffer(object):
|
|||||||
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
|
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
|
||||||
else:
|
else:
|
||||||
if num > 0:
|
if num > 0:
|
||||||
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
|
[self.insert(i, False) for i in self.session.db[self.name]["items"][-num:]]
|
||||||
return retrieved
|
return retrieved
|
||||||
|
|
||||||
def get_more_items(self):
|
def get_more_items(self):
|
||||||
|
@ -138,14 +138,12 @@ class vkSession(object):
|
|||||||
log.debug("Params for sending to vk: %r" % (kwargs,))
|
log.debug("Params for sending to vk: %r" % (kwargs,))
|
||||||
data = getattr(self.vk.client.newsfeed, "get")(*args, **kwargs)
|
data = getattr(self.vk.client.newsfeed, "get")(*args, **kwargs)
|
||||||
if data != None:
|
if data != None:
|
||||||
if show_nextpage == False:
|
|
||||||
self.process_usernames(data)
|
self.process_usernames(data)
|
||||||
# else:
|
|
||||||
# print data.keys(), len(data["items"]), data["next_from"]
|
|
||||||
num = self.order_buffer(name, data["items"], show_nextpage)
|
num = self.order_buffer(name, data["items"], show_nextpage)
|
||||||
log.debug("Keys of the returned data for debug purposes: %r" % (list(data.keys()),))
|
log.debug("Keys of the returned data for debug purposes: %r" % (list(data.keys()),))
|
||||||
if "next_from" in data:
|
if "next_from" in data:
|
||||||
self.db[name]["cursor"] = data["next_from"]
|
self.db[name]["cursor"] = data["next_from"]
|
||||||
|
log.debug("Next cursor saved for data: {cursor}".format(cursor=data["next_from"]))
|
||||||
return num
|
return num
|
||||||
|
|
||||||
def get_page(self, name="", show_nextpage=False, endpoint="", *args, **kwargs):
|
def get_page(self, name="", show_nextpage=False, endpoint="", *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user