Mercurial > libervia-backend
diff src/plugins/plugin_misc_invitations.py @ 2212:eaf2467d19ce
plugin invitations: added getInvitation method, it return invitation data and raise an error if it is not found
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Mar 2017 19:42:42 +0200 |
parents | df115e4a36c7 |
children | 77a3d0a28642 |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_invitations.py Wed Mar 29 19:35:55 2017 +0200 +++ b/src/plugins/plugin_misc_invitations.py Wed Mar 29 19:42:42 2017 +0200 @@ -72,6 +72,10 @@ host.bridge.addMethod("invitationCreate", ".plugin", in_sign='sssssssssa{ss}s', out_sign='a{ss}', method=self._createInvitation, async=True) + host.bridge.addMethod("invitationGet", ".plugin", in_sign='s', out_sign='a{ss}', + method=self.getInvitation, + async=True) + def _createInvitation(self, jid_=u'', password=u'', name=u'', host_name=u'', email=u'', language=u'', url_template=u'', message_subject=u'', message_body=u'', extra=None, profile=u''): # XXX: we don't use **kwargs here to keep arguments name for introspection with D-Bus bridge @@ -259,3 +263,12 @@ extra[KEY_ID] = id_ extra[KEY_JID] = jid defer.returnValue(extra) + + def getInvitation(self, id_): + """Retrieve invitation linked to uuid if it exists + + @param id_(unicode): UUID linked to an invitation + @return dict(unicode, unicode): data associated to the invitation + @raise KeyError: there is not invitation with this id_ + """ + return self.invitations[id_]