Started some kind of implementation

This commit is contained in:
2019-10-11 17:39:19 -05:00
parent 63def5530f
commit 9e6e72c0a1
5 changed files with 40 additions and 6 deletions

View File

@@ -280,4 +280,22 @@ def render_document(document, session):
size = convert_bytes(document["size"])
date = arrow.get(document["date"]).humanize(locale=languageHandler.curLang[:2])
doc_type = doc_types[document["type"]]
return [user["user1_nom"], title, doc_type, size, date]
return [user["user1_nom"], title, doc_type, size, date]
def render_notification(notification, session):
notification.pop("hide_buttons")
print(notification["icon_type"])
# print(notification["header"])
print(notification)
date = arrow.get(notification["date"]).humanize(locale=languageHandler.curLang[:2])
msg = notification["header"]
# msg = notification["header"]
# if notification["type"] == "follow":
# if len(notification["feedback"]) == 1:
# user = session.get_user(notification["feedback"][0])
# msg = _("{user1_nom} subscribed to your account").format(**user)
# else:
# users = ["{first_name} {last_name},".format(first_name=user["first_name"], last_name=user["last_name"]) for user in notification["feedback"]]
# msg = " ".join(users)
# print(msg)
return [msg, date]

View File

@@ -207,6 +207,9 @@ class vkSession(object):
else:
kwargs.update(offset=0)
formatted_endpoint = "{formatted_endpoint}.{new_path}".format(formatted_endpoint=formatted_endpoint, new_path=endpoint)
offset_deprecated = ["notifications.get"]
if formatted_endpoint in offset_deprecated:
kwargs.update(offset=None)
log.debug("Calling endpoint %s with params %r" % (formatted_endpoint, kwargs,))
data = getattr(p, endpoint)(*args, **kwargs)
if data != None:
@@ -218,7 +221,8 @@ class vkSession(object):
data["items"].reverse()
if type(data) == dict:
num = self.order_buffer(name, data["items"], show_nextpage)
self.db[name]["offset"] = kwargs["offset"]+kwargs["count"]
if formatted_endpoint not in offset_deprecated:
self.db[name]["offset"] = kwargs["offset"]+kwargs["count"]
if len(data["items"]) > 0 and "first_name" in data["items"][0]:
data2 = {"profiles": [], "groups": []}
for i in data["items"]: