Added some comments to the new post function
This commit is contained in:
parent
f41dd51dc7
commit
60d283f931
@ -312,12 +312,16 @@ class vkSession(object):
|
||||
""" Generic function to be called whenever user wants to post something to VK.
|
||||
This function should be capable of uploading all attachments before posting, and send a special event in case the post has failed,
|
||||
So the program can recreate the post and show it back to the user."""
|
||||
# ToDo: this function will occasionally be called with attachments already set to post_arguments, example if the user could upload the files but was unable to send the post due to a connection problem.
|
||||
# We should see what can be done (reuploading everything vs using the already added attachments).
|
||||
attachments = ""
|
||||
# Firstly, let's try to upload the attachments here. If peer_id exists in post_arguments,
|
||||
# It means we are talking about private messages, whose attachment procedures have their own methods.
|
||||
if len(attachments_list) > 0:
|
||||
try:
|
||||
attachments = self.upload_attachments(attachments_list, post_arguments.get("peer_id"))
|
||||
except Exception as error:
|
||||
log.exception("Error calling method %s.%s with arguments: %r. Failed during loading attachments. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
|
||||
log.error("Error calling method %s.%s with arguments: %r. Failed during loading attachments. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
|
||||
# Report a failed function here too with same arguments so the client should be able to recreate it again.
|
||||
pub.sendMessage("postFailed", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
||||
# VK generally defines all kind of messages under "text", "message" or "body" so let's try with all of those
|
||||
|
Loading…
Reference in New Issue
Block a user