Mercurial > libervia-backend
annotate sat_frontends/jp/cmd_event.py @ 2953:3caf460bc125
tools (email): moved email code to common so it can be used by frontends
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 26 May 2019 22:20:33 +0200 |
parents | b2f323237fce |
children | ab2696e34d29 |
rev | line source |
---|---|
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # jp: a SàT command line tool |
2771 | 5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 import base |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from sat.core.i18n import _ |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
23 from sat.tools.common.ansi import ANSI as A |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from sat_frontends.jp.constants import Const as C |
2284
4fd010f29f99
jp (blog, event): added checkURI to some command to be able to enter a xmpp: uri as argument
Goffi <goffi@goffi.org>
parents:
2283
diff
changeset
|
25 from sat_frontends.jp import common |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from functools import partial |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
27 from dateutil import parser as du_parser |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
28 import calendar |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
29 import time |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 __commands__ = ["Event"] |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
33 OUTPUT_OPT_TABLE = u"table" |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
34 |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
35 # TODO: move date parsing to base, it may be useful for other commands |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
36 |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 class Get(base.CommandBase): |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
40 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
41 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
42 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
43 "get", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
44 use_output=C.OUTPUT_DICT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
45 use_pubsub=True, |
2910
b2f323237fce
jp, plugin merge-requests: used u'' as default for item id in pubsub arguments + fixed some required arguments:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
46 pubsub_flags={C.SINGLE_ITEM}, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
47 use_verbose=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
48 help=_(u"get event data"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
49 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
50 self.need_loop = True |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
51 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
52 def add_parser_options(self): |
2532 | 53 pass |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
54 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
55 def eventInviteeGetCb(self, result): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
56 event_date, event_data = result |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
57 event_data["date"] = event_date |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
58 self.output(event_data) |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
59 self.host.quit() |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
60 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
61 def start(self): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
62 self.host.bridge.eventGet( |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
63 self.args.service, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
64 self.args.node, |
2283
5b04fc0c663d
jp (pubsub/get): renamed --id option to --item for consistency with other commands
Goffi <goffi@goffi.org>
parents:
2247
diff
changeset
|
65 self.args.item, |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
66 self.profile, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
67 callback=self.eventInviteeGetCb, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
68 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
69 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
70 msg=_(u"can't get event data: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
71 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
72 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
73 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
74 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
75 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
76 class EventBase(object): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
77 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
78 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
79 "-i", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
80 "--id", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
81 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
82 default=u"", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
83 help=_(u"ID of the PubSub Item"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
84 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
85 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
86 "-d", "--date", type=unicode, help=_(u"date of the event") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
87 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
88 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
89 "-f", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
90 "--field", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
91 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
92 action="append", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
93 nargs=2, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
94 dest="fields", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
95 metavar=(u"KEY", u"VALUE"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
96 help=_(u"configuration field to set"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
97 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
98 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
99 def parseFields(self): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
100 return dict(self.args.fields) if self.args.fields else {} |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
101 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
102 def parseDate(self): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
103 if self.args.date: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
104 try: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
105 date = int(self.args.date) |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
106 except ValueError: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
107 try: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
108 date_time = du_parser.parse( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
109 self.args.date, dayfirst=not (u"-" in self.args.date) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
110 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
111 except ValueError as e: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
112 self.parser.error(_(u"Can't parse date: {msg}").format(msg=e)) |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
113 if date_time.tzinfo is None: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
114 date = calendar.timegm(date_time.timetuple()) |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
115 else: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
116 date = time.mktime(date_time.timetuple()) |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
117 else: |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
118 date = -1 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
119 return date |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
120 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
121 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
122 class Create(EventBase, base.CommandBase): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
123 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
124 super(Create, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
125 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
126 "create", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
127 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
128 help=_("create or replace event"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
129 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
130 EventBase.__init__(self) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
131 self.need_loop = True |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
132 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
133 def eventCreateCb(self, node): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
134 self.disp(_(u"Event created successfuly on node {node}").format(node=node)) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
135 self.host.quit() |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
136 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
137 def start(self): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
138 fields = self.parseFields() |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
139 date = self.parseDate() |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
140 self.host.bridge.eventCreate( |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
141 date, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
142 fields, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
143 self.args.service, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
144 self.args.node, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
145 self.args.id, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
146 self.profile, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
147 callback=self.eventCreateCb, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
148 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
149 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
150 msg=_(u"can't create event: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
151 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
152 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
153 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
154 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
155 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
156 class Modify(EventBase, base.CommandBase): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
157 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
158 super(Modify, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
159 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
160 "modify", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
161 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
162 pubsub_flags={C.NODE}, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
163 help=_("modify an existing event"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
164 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
165 EventBase.__init__(self) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
166 self.need_loop = True |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
167 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
168 def start(self): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
169 fields = self.parseFields() |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
170 date = 0 if not self.args.date else self.parseDate() |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
171 self.host.bridge.eventModify( |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
172 self.args.service, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
173 self.args.node, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
174 self.args.id, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
175 date, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
176 fields, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
177 self.profile, |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
178 callback=self.host.quit, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
179 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
180 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
181 msg=_(u"can't update event data: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
182 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
183 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
184 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
185 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
186 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
187 class InviteeGet(base.CommandBase): |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
188 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
189 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
190 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
191 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
192 "get", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
193 use_output=C.OUTPUT_DICT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
194 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
195 pubsub_flags={C.NODE, C.ITEM, C.SINGLE_ITEM}, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
196 use_verbose=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
197 help=_(u"get event attendance"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
198 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
199 self.need_loop = True |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
200 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
201 def add_parser_options(self): |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
202 pass |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
203 |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
204 def eventInviteeGetCb(self, event_data): |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
205 self.output(event_data) |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
206 self.host.quit() |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
207 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
208 def start(self): |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
209 self.host.bridge.eventInviteeGet( |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
210 self.args.service, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
211 self.args.node, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
212 self.profile, |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
213 callback=self.eventInviteeGetCb, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
214 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
215 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
216 msg=_(u"can't get event data: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
217 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
218 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
219 ) |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
220 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
221 |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
222 class InviteeSet(base.CommandBase): |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
223 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
224 super(InviteeSet, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
225 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
226 "set", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
227 use_output=C.OUTPUT_DICT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
228 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
229 pubsub_flags={C.NODE}, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
230 help=_("set event attendance"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
231 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
232 self.need_loop = True |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
233 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
234 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
235 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
236 "-f", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
237 "--field", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
238 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
239 action="append", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
240 nargs=2, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
241 dest="fields", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
242 metavar=(u"KEY", u"VALUE"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
243 help=_(u"configuration field to set"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
244 ) |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
245 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
246 def start(self): |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
247 fields = dict(self.args.fields) if self.args.fields else {} |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
248 self.host.bridge.eventInviteeSet( |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
249 self.args.service, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
250 self.args.node, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
251 fields, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
252 self.profile, |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
253 callback=self.host.quit, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
254 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
255 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
256 msg=_(u"can't set event data: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
257 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
258 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
259 ) |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
260 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
261 |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
262 class InviteesList(base.CommandBase): |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
263 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
264 extra_outputs = {"default": self.default_output} |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
265 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
266 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
267 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
268 "list", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
269 use_output=C.OUTPUT_DICT_DICT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
270 extra_outputs=extra_outputs, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
271 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
272 pubsub_flags={C.NODE}, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
273 use_verbose=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
274 help=_(u"get event attendance"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
275 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
276 self.need_loop = True |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
277 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
278 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
279 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
280 "-m", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
281 "--missing", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
282 action="store_true", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
283 help=_(u"show missing people (invited but no R.S.V.P. so far)"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
284 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
285 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
286 "-R", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
287 "--no-rsvp", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
288 action="store_true", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
289 help=_(u"don't show people which gave R.S.V.P."), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
290 ) |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
291 |
2491
5895e4daae8c
jp (event): added missing arg to _attend_filter
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
292 def _attend_filter(self, attend, row): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
293 if attend == u"yes": |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
294 attend_color = C.A_SUCCESS |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
295 elif attend == u"no": |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
296 attend_color = C.A_FAILURE |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
297 else: |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
298 attend_color = A.FG_WHITE |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
299 return A.color(attend_color, attend) |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
300 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
301 def _guests_filter(self, guests): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
302 return u"(" + unicode(guests) + ")" if guests else u"" |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
303 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
304 def default_output(self, event_data): |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
305 data = [] |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
306 attendees_yes = 0 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
307 attendees_maybe = 0 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
308 attendees_no = 0 |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
309 attendees_missing = 0 |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
310 guests = 0 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
311 guests_maybe = 0 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
312 for jid_, jid_data in event_data.iteritems(): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
313 jid_data[u"jid"] = jid_ |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
314 try: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
315 guests_int = int(jid_data["guests"]) |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
316 except (ValueError, KeyError): |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
317 pass |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
318 attend = jid_data.get(u"attend", u"") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
319 if attend == "yes": |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
320 attendees_yes += 1 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
321 guests += guests_int |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
322 elif attend == "maybe": |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
323 attendees_maybe += 1 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
324 guests_maybe += guests_int |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
325 elif attend == "no": |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
326 attendees_no += 1 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
327 jid_data[u"guests"] = "" |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
328 else: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
329 attendees_missing += 1 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
330 jid_data[u"guests"] = "" |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
331 data.append(jid_data) |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
332 |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
333 show_table = OUTPUT_OPT_TABLE in self.args.output_opts |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
334 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
335 table = common.Table.fromDict( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
336 self.host, |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
337 data, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
338 (u"nick",) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
339 + ((u"jid",) if self.host.verbosity else ()) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
340 + (u"attend", "guests"), |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
341 headers=None, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
342 filters={ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
343 u"nick": A.color(C.A_HEADER, u"{}" if show_table else u"{} "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
344 u"jid": u"{}" if show_table else u"{} ", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
345 u"attend": self._attend_filter, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
346 u"guests": u"{}" if show_table else self._guests_filter, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
347 }, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
348 defaults={u"nick": u"", u"attend": u"", u"guests": 1}, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
349 ) |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
350 if show_table: |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
351 table.display() |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
352 else: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
353 table.display_blank(show_header=False, col_sep=u"") |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
354 |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
355 if not self.args.no_rsvp: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
356 self.disp(u"") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
357 self.disp( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
358 A.color( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
359 C.A_SUBHEADER, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
360 _(u"Attendees: "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
361 A.RESET, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
362 unicode(len(data)), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
363 _(u" ("), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
364 C.A_SUCCESS, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
365 _(u"yes: "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
366 unicode(attendees_yes), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
367 A.FG_WHITE, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
368 _(u", maybe: "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
369 unicode(attendees_maybe), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
370 u", ", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
371 C.A_FAILURE, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
372 _(u"no: "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
373 unicode(attendees_no), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
374 A.RESET, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
375 u")", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
376 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
377 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
378 self.disp( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
379 A.color(C.A_SUBHEADER, _(u"confirmed guests: "), A.RESET, unicode(guests)) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
380 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
381 self.disp( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
382 A.color( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
383 C.A_SUBHEADER, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
384 _(u"unconfirmed guests: "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
385 A.RESET, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
386 unicode(guests_maybe), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
387 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
388 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
389 self.disp( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
390 A.color( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
391 C.A_SUBHEADER, _(u"total: "), A.RESET, unicode(guests + guests_maybe) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
392 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
393 ) |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
394 if attendees_missing: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
395 self.disp("") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
396 self.disp( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
397 A.color( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
398 C.A_SUBHEADER, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
399 _(u"missing people (no reply): "), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
400 A.RESET, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
401 unicode(attendees_missing), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
402 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
403 ) |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
404 |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
405 def eventInviteesListCb(self, event_data, prefilled_data): |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
406 """fill nicknames and keep only requested people |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
407 |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
408 @param event_data(dict): R.S.V.P. answers |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
409 @param prefilled_data(dict): prefilled data with all people |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
410 only filled if --missing is used |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
411 """ |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
412 if self.args.no_rsvp: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
413 for jid_ in event_data: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
414 # if there is a jid in event_data |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
415 # it must be there in prefilled_data too |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
416 # so no need to check for KeyError |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
417 del prefilled_data[jid_] |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
418 else: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
419 # we replace empty dicts for existing people with R.S.V.P. data |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
420 prefilled_data.update(event_data) |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
421 |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
422 # we get nicknames for everybody, make it easier for organisers |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
423 for jid_, data in prefilled_data.iteritems(): |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
424 id_data = self.host.bridge.identityGet(jid_, self.profile) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
425 data[u"nick"] = id_data.get(u"nick", u"") |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
426 |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
427 self.output(prefilled_data) |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
428 self.host.quit() |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
429 |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
430 def getList(self, prefilled_data={}): |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
431 self.host.bridge.eventInviteesList( |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
432 self.args.service, |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
433 self.args.node, |
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
434 self.profile, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
435 callback=partial(self.eventInviteesListCb, prefilled_data=prefilled_data), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
436 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
437 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
438 msg=_(u"can't get event data: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
439 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
440 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
441 ) |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
442 |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
443 def psNodeAffiliationsGetCb(self, affiliations): |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
444 # we fill all affiliations with empty data |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
445 # answered one will be filled in eventInviteesListCb |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
446 # we only consider people with "publisher" affiliation as invited, creators are not, and members can just observe |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
447 prefilled = { |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
448 jid_: {} |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
449 for jid_, affiliation in affiliations.iteritems() |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
450 if affiliation in (u"publisher",) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
451 } |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
452 self.getList(prefilled) |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
453 |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
454 def start(self): |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
455 if self.args.no_rsvp and not self.args.missing: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
456 self.parser.error(_(u"you need to use --missing if you use --no-rsvp")) |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
457 if self.args.missing: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
458 self.host.bridge.psNodeAffiliationsGet( |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
459 self.args.service, |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
460 self.args.node, |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
461 self.profile, |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
462 callback=self.psNodeAffiliationsGetCb, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
463 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
464 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
465 msg=_(u"can't get event data: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
466 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
467 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
468 ) |
2321
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
469 else: |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
470 self.getList() |
c2a9da96e40b
jp (event/attendee/list): added --missing to show missing people (ones who didn't replied) and --no-rsvp to hide ones who answered
Goffi <goffi@goffi.org>
parents:
2301
diff
changeset
|
471 |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
472 |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
473 class InviteeInvite(base.CommandBase): |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
474 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
475 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
476 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
477 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
478 "invite", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
479 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
480 pubsub_flags={C.NODE, C.SINGLE_ITEM}, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
481 help=_(u"invite someone to the event through email"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
482 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
483 self.need_loop = True |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
484 |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
485 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
486 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
487 "-e", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
488 "--email", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
489 action="append", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
490 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
491 default=[], |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
492 help="email(s) to send the invitation to", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
493 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
494 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
495 "-N", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
496 "--name", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
497 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
498 default="", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
499 help="name of the invitee", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
500 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
501 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
502 "-H", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
503 "--host-name", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
504 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
505 default="", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
506 help="name of the host", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
507 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
508 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
509 "-l", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
510 "--lang", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
511 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
512 default="", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
513 help="main language spoken by the invitee", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
514 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
515 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
516 "-U", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
517 "--url-template", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
518 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
519 default="", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
520 help="template to construct the URL", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
521 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
522 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
523 "-S", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
524 "--subject", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
525 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
526 default="", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
527 help="subject of the invitation email (default: generic subject)", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
528 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
529 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
530 "-b", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
531 "--body", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
532 type=base.unicode_decoder, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
533 default="", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
534 help="body of the invitation email (default: generic body)", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
535 ) |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
536 |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
537 def start(self): |
2291
c05000d00dbb
plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents:
2288
diff
changeset
|
538 email = self.args.email[0] if self.args.email else None |
c05000d00dbb
plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents:
2288
diff
changeset
|
539 emails_extra = self.args.email[1:] |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
540 |
2616
1cc88adb5142
plugin events: invitations improvments + personal list
Goffi <goffi@goffi.org>
parents:
2614
diff
changeset
|
541 self.host.bridge.eventInviteByEmail( |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
542 self.args.service, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
543 self.args.node, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
544 self.args.item, |
2291
c05000d00dbb
plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents:
2288
diff
changeset
|
545 email, |
c05000d00dbb
plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents:
2288
diff
changeset
|
546 emails_extra, |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
547 self.args.name, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
548 self.args.host_name, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
549 self.args.lang, |
2532 | 550 self.args.url_template, |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
551 self.args.subject, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
552 self.args.body, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
553 self.args.profile, |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
554 callback=self.host.quit, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
555 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
556 self.errback, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
557 msg=_(u"can't create invitation: {}"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
558 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
559 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
560 ) |
2288
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
561 |
f4d8d83a50e2
jp (event/invitee/invite): command to use new eventInvite backend method
Goffi <goffi@goffi.org>
parents:
2284
diff
changeset
|
562 |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
563 class Invitee(base.CommandBase): |
2300
173d56315529
jp (event/invitee): added list command to get R.S.V.P. :
Goffi <goffi@goffi.org>
parents:
2299
diff
changeset
|
564 subcommands = (InviteeGet, InviteeSet, InviteesList, InviteeInvite) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
565 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
566 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
567 super(Invitee, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
568 host, "invitee", use_profile=False, help=_(u"manage invities") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
569 ) |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
570 |
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
571 |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
572 class Event(base.CommandBase): |
2244
9d49e66bdbf2
jp (event): creation/modification of main event + invitee commands are now in a "invitee" subcommand
Goffi <goffi@goffi.org>
parents:
2236
diff
changeset
|
573 subcommands = (Get, Create, Modify, Invitee) |
2236
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
574 |
4b1873ce6b61
jp (event): event handling commands, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
575 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
576 super(Event, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
577 host, "event", use_profile=False, help=_("event management") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2616
diff
changeset
|
578 ) |