annotate libervia/web/pages/events/admin/page_meta.py @ 1595:7941444c1671

pages: set `own_local_jid` to avoid confusion with `own_jid`: - `own_jid` is the real JID of the user. - `own_local_jid` is the JID used in chat, which can be real JID, or a room JID.
author Goffi <goffi@goffi.org>
date Wed, 13 Dec 2023 22:05:48 +0100
parents eb00d593801d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
1 #!/usr/bin/env python3
1239
f511f8fbbf8a fixed shebangs
Goffi <goffi@goffi.org>
parents: 1229
diff changeset
2
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
3
1518
eb00d593801d refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents: 1509
diff changeset
4 from libervia.web.server.constants import Const as C
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
5 from twisted.words.protocols.jabber import jid
1518
eb00d593801d refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents: 1509
diff changeset
6 from libervia.backend.tools.common.template import safe
eb00d593801d refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents: 1509
diff changeset
7 from libervia.backend.tools.common import data_format
eb00d593801d refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents: 1509
diff changeset
8 from libervia.backend.core.i18n import _, D_
eb00d593801d refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents: 1509
diff changeset
9 from libervia.backend.core.log import getLogger
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
10 import time
1229
acec8e9185db pages: replaced deprecated `cgi.escape` by `html.escape`
Goffi <goffi@goffi.org>
parents: 1216
diff changeset
11 import html
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
12 import math
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
13 import re
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
14
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
15 name = "event_admin"
1418
d6bcb0cf92d2 pages: add some labels
Goffi <goffi@goffi.org>
parents: 1302
diff changeset
16 label = D_("Event Administration")
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
17 access = C.PAGES_ACCESS_PROFILE
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
18 template = "event/admin.html"
1145
29eb15062416 pages: set __name__ for imported pages
Goffi <goffi@goffi.org>
parents: 1124
diff changeset
19 log = getLogger(__name__)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
20 REG_EMAIL_RE = re.compile(C.REG_EMAIL_RE, re.IGNORECASE)
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
21
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
22
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
23 def parse_url(self, request):
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
24 self.get_path_args(
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
25 request,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
26 ("event_service", "event_node", "event_id"),
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
27 min_args=2,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
28 event_service="@jid",
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
29 event_id="",
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
30 )
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
31
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
32
1302
04e7dd6b6f4d pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents: 1239
diff changeset
33 async def prepare_render(self, request):
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
34 data = self.get_r_data(request)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
35 template_data = request.template_data
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
36
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
37 ## Event ##
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
38
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
39 event_service = template_data["event_service"] = data["event_service"]
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
40 event_node = template_data["event_node"] = data["event_node"]
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
41 event_id = template_data["event_id"] = data["event_id"]
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
42 profile = self.get_profile(request)
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
43 event_timestamp, event_data = await self.host.bridge_call(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
44 "eventGet",
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
45 event_service.userhost() if event_service else "",
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
46 event_node,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
47 event_id,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
48 profile,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
49 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
50 try:
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
51 background_image = event_data.pop("background-image")
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
52 except KeyError:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
53 pass
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
54 else:
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
55 template_data["dynamic_style"] = safe(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
56 """
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
57 html {
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
58 background-image: url("%s");
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
59 background-size: 15em;
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
60 }
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
61 """
1229
acec8e9185db pages: replaced deprecated `cgi.escape` by `html.escape`
Goffi <goffi@goffi.org>
parents: 1216
diff changeset
62 % html.escape(background_image, True)
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
63 )
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
64 template_data["event"] = event_data
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
65 invitees = await self.host.bridge_call(
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
66 "event_invitees_list",
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
67 event_data["invitees_service"],
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
68 event_data["invitees_node"],
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
69 profile,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
70 )
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
71 template_data["invitees"] = invitees
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
72 invitees_guests = 0
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
73 for invitee_data in invitees.values():
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
74 if invitee_data.get("attend", "no") == "no":
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
75 continue
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
76 try:
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
77 invitees_guests += int(invitee_data.get("guests", 0))
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
78 except ValueError:
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
79 log.warning(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
80 _("guests value is not valid: {invitee}").format(invitee=invitee_data)
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
81 )
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
82 template_data["invitees_guests"] = invitees_guests
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
83 template_data["days_left"] = int(
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
84 math.ceil((event_timestamp - time.time()) / (60 * 60 * 24))
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
85 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
86
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
87 ## Blog ##
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
88
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
89 data["service"] = jid.JID(event_data["blog_service"])
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
90 data["node"] = event_data["blog_node"]
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
91 data["allow_commenting"] = "simple"
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
92
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
93 # we now need blog items, using blog common page
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
94 # this will fill the "items" template data
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
95 blog_page = self.get_page_by_name("blog_view")
1302
04e7dd6b6f4d pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents: 1239
diff changeset
96 await blog_page.prepare_render(self, request)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
97
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
98
1302
04e7dd6b6f4d pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents: 1239
diff changeset
99 async def on_data_post(self, request):
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
100 profile = self.get_profile(request)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
101 if not profile:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
102 log.error("got post data without profile")
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
103 self.page_error(request, C.HTTP_INTERNAL_ERROR)
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
104 type_ = self.get_posted_data(request, "type")
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
105 if type_ == "blog":
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
106 service, node, title, body, lang = self.get_posted_data(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
107 request, ("service", "node", "title", "body", "language")
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
108 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
109
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
110 if not body.strip():
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
111 self.page_error(request, C.HTTP_BAD_REQUEST)
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
112 data = {"content": body}
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
113 if title:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
114 data["title"] = title
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
115 if lang:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
116 data["language"] = lang
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
117 try:
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
118 comments = bool(self.get_posted_data(request, "comments").strip())
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
119 except KeyError:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
120 pass
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
121 else:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
122 if comments:
1302
04e7dd6b6f4d pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
Goffi <goffi@goffi.org>
parents: 1239
diff changeset
123 data["allow_comments"] = True
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
124
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
125 try:
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
126 await self.host.bridge_call(
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
127 "mb_send", service, node, data_format.serialise(data), profile)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
128 except Exception as e:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
129 if "forbidden" in str(e):
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
130 self.page_error(request, C.HTTP_FORBIDDEN)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
131 else:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
132 raise e
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
133 elif type_ == "event":
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
134 service, node, event_id, jids, emails = self.get_posted_data(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
135 request, ("service", "node", "event_id", "jids", "emails")
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
136 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
137 for invitee_jid_s in jids.split():
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
138 try:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
139 invitee_jid = jid.JID(invitee_jid_s)
1229
acec8e9185db pages: replaced deprecated `cgi.escape` by `html.escape`
Goffi <goffi@goffi.org>
parents: 1216
diff changeset
140 except RuntimeError:
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
141 log.warning(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
142 _("this is not a valid jid: {jid}").format(jid=invitee_jid_s)
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
143 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
144 continue
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
145 await self.host.bridge_call(
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
146 "event_invite", invitee_jid.userhost(), service, node, event_id, profile
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
147 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
148 for email_addr in emails.split():
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
149 if not REG_EMAIL_RE.match(email_addr):
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
150 log.warning(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
151 _("this is not a valid email address: {email}").format(
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
152 email=email_addr
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
153 )
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
154 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
155 continue
1509
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
156 await self.host.bridge_call(
106bae41f5c8 massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 1418
diff changeset
157 "event_invite_by_email",
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
158 service,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
159 node,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
160 event_id,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
161 email_addr,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
162 {},
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
163 "",
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
164 "",
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
165 "",
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
166 "",
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
167 "",
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
168 "",
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
169 profile,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
170 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
171
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
172 else:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
173 log.warning(_("Unhandled data type: {}").format(type_))