comparison frontends/src/jp/cmd_event.py @ 2288:f4d8d83a50e2

jp (event/invitee/invite): command to use new eventInvite backend method
author Goffi <goffi@goffi.org>
date Thu, 29 Jun 2017 20:57:14 +0200
parents 4fd010f29f99
children c05000d00dbb
comparison
equal deleted inserted replaced
2287:ea869f30f204 2288:f4d8d83a50e2
194 errback=partial(self.errback, 194 errback=partial(self.errback,
195 msg=_(u"can't set event data: {}"), 195 msg=_(u"can't set event data: {}"),
196 exit_code=C.EXIT_BRIDGE_ERRBACK)) 196 exit_code=C.EXIT_BRIDGE_ERRBACK))
197 197
198 198
199 class InviteeInvite(base.CommandBase):
200
201 def __init__(self, host):
202 base.CommandBase.__init__(self, host, 'invite', use_pubsub_node_req=True, help=_(u'invite someone to the event through email'))
203 self.need_loop=True
204
205 def add_parser_options(self):
206 self.parser.add_argument("-i", "--item", type=base.unicode_decoder, default=u'', help=_(u"ID of the PubSub Item"))
207 self.parser.add_argument("-e", "--email", type=base.unicode_decoder, default='', help='email to send the invitation to (if --no-email is set, email will just be saved)')
208 self.parser.add_argument("-n", "--name", type=base.unicode_decoder, default='', help='name of the invitee')
209 self.parser.add_argument("-N", "--host-name", type=base.unicode_decoder, default='', help='name of the host')
210 self.parser.add_argument("-l", "--lang", type=base.unicode_decoder, default='', help='main language spoken by the invitee')
211 self.parser.add_argument("-u", "--url", type=base.unicode_decoder, default='', help='template to construct the URL')
212 self.parser.add_argument("-S", "--subject", type=base.unicode_decoder, default='', help='subject of the invitation email (default: generic subject)')
213 self.parser.add_argument("-b", "--body", type=base.unicode_decoder, default='', help='body of the invitation email (default: generic body)')
214
215 def start(self):
216 common.checkURI(self.args)
217
218 self.host.bridge.eventInvite(
219 self.args.service,
220 self.args.node,
221 self.args.item,
222 self.args.email,
223 self.args.name,
224 self.args.host_name,
225 self.args.lang,
226 self.args.url,
227 self.args.subject,
228 self.args.body,
229 self.args.profile,
230 callback=self.host.quit,
231 errback=partial(self.errback,
232 msg=_(u"can't create invitation: {}"),
233 exit_code=C.EXIT_BRIDGE_ERRBACK))
234
235
199 class Invitee(base.CommandBase): 236 class Invitee(base.CommandBase):
200 subcommands = (InviteeGet, InviteeSet) 237 subcommands = (InviteeGet, InviteeSet, InviteeInvite)
201 238
202 def __init__(self, host): 239 def __init__(self, host):
203 super(Invitee, self).__init__(host, 'invitee', use_profile=False, help=_(u'manage invities')) 240 super(Invitee, self).__init__(host, 'invitee', use_profile=False, help=_(u'manage invities'))
204 241
205 242