Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0277.py @ 1831:68c0dc13d821
plugin blog import, XEP-0277: progress + redirect:
- progression is now handled
- url redirections are handled with PubSub URIs, and returned as metadata with progressFinished
- tmp_dir is cleaned in a finally close
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 23 Jan 2016 20:01:28 +0100 |
parents | 6079752ffeae |
children | b3b25dbac585 |
comparison
equal
deleted
inserted
replaced
1830:74676624ad5d | 1831:68c0dc13d821 |
---|---|
63 class NodeAccessChangeException(Exception): | 63 class NodeAccessChangeException(Exception): |
64 pass | 64 pass |
65 | 65 |
66 | 66 |
67 class XEP_0277(object): | 67 class XEP_0277(object): |
68 namespace = NS_MICROBLOG | |
68 | 69 |
69 def __init__(self, host): | 70 def __init__(self, host): |
70 log.info(_(u"Microblogging plugin initialization")) | 71 log.info(_(u"Microblogging plugin initialization")) |
71 self.host = host | 72 self.host = host |
72 self._p = self.host.plugins["XEP-0060"] # this facilitate the access to pubsub plugin | 73 self._p = self.host.plugins["XEP-0060"] # this facilitate the access to pubsub plugin |
452 | 453 |
453 defer.returnValue(item_elt) | 454 defer.returnValue(item_elt) |
454 | 455 |
455 ## publish ## | 456 ## publish ## |
456 | 457 |
457 def getCommentNode(self, item_id): | 458 def getCommentsNode(self, item_id): |
458 """Generate comment node | 459 """Generate comment node |
459 | 460 |
460 @param item_id(unicode): id of the parent item | 461 @param item_id(unicode): id of the parent item |
461 @return (unicode): comment node to use | 462 @return (unicode): comment node to use |
462 """ | 463 """ |
463 return u"{}{}".format(NS_COMMENT_PREFIX, item_id) | 464 return u"{}{}".format(NS_COMMENT_PREFIX, item_id) |
464 | 465 |
465 def getCommentService(self, client, parent_service=None): | 466 def getCommentsService(self, client, parent_service=None): |
466 """Get prefered PubSub service to create comment node | 467 """Get prefered PubSub service to create comment node |
467 | 468 |
468 @param pubsub_service(jid.JID, None): PubSub service of the parent item | 469 @param pubsub_service(jid.JID, None): PubSub service of the parent item |
469 @param return(jid.JID, None): PubSub service to use | 470 @param return(jid.JID, None): PubSub service to use |
470 """ | 471 """ |