annotate libervia/pages/events/admin/page_meta.py @ 1216:b2d067339de3

python 3 port: /!\ Python 3.6+ is now needed to use libervia /!\ instability may occur and features may not be working anymore, this will improve with time /!\ TxJSONRPC dependency has been removed The same procedure as in backend has been applied (check backend commit ab2696e34d29 logs for details). Removed now deprecated code (Pyjamas compiled browser part, legacy blog, JSON RPC related code). Adapted code to work without `html` and `themes` dirs.
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:12:31 +0200
parents 0f37b65fe7c2
children acec8e9185db
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
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
3
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
4 from libervia.server.constants import Const as C
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
5 from twisted.internet import defer
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
6 from twisted.words.protocols.jabber import jid
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
7 from sat.tools.common.template import safe
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
8 from sat.core.i18n import _
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
9 from sat.core.log import getLogger
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
10 import time
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
11 import cgi
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"
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
16 access = C.PAGES_ACCESS_PROFILE
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
17 template = "event/admin.html"
1145
29eb15062416 pages: set __name__ for imported pages
Goffi <goffi@goffi.org>
parents: 1124
diff changeset
18 log = getLogger(__name__)
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
19 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
20
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 def parse_url(self, request):
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
23 self.getPathArgs(
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
24 request,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
25 ("event_service", "event_node", "event_id"),
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
26 min_args=2,
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
27 event_service="@jid",
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
28 event_id="",
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
29 )
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
30
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
31
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
32 @defer.inlineCallbacks
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
33 def prepare_render(self, request):
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
34 data = self.getRData(request)
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"]
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
42 profile = self.getProfile(request)
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
43 event_timestamp, event_data = yield self.host.bridgeCall(
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 """
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
62 % cgi.escape(background_image, True)
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
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
65 invitees = yield self.host.bridgeCall(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
66 "eventInviteesList",
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
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
95 blog_page = self.getPageByName("blog_view")
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
96 yield blog_page.prepare_render(self, request)
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
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
99 @defer.inlineCallbacks
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
100 def on_data_post(self, request):
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
101 profile = self.getProfile(request)
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
102 if not profile:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
103 log.error("got post data without profile")
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
104 self.pageError(request, C.HTTP_INTERNAL_ERROR)
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
105 type_ = self.getPostedData(request, "type")
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
106 if type_ == "blog":
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
107 service, node, title, body, lang = self.getPostedData(
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
108 request, ("service", "node", "title", "body", "language")
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
109 )
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
110
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
111 if not body.strip():
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
112 self.pageError(request, C.HTTP_BAD_REQUEST)
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
113 data = {"content": body}
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
114 if title:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
115 data["title"] = title
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
116 if lang:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
117 data["language"] = lang
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
118 try:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
119 comments = bool(self.getPostedData(request, "comments").strip())
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
120 except KeyError:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
121 pass
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
122 else:
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
123 if comments:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
124 data["allow_comments"] = C.BOOL_TRUE
1111
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
125
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
126 try:
1216
b2d067339de3 python 3 port:
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
127 yield self.host.bridgeCall("mbSend", service, node, 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):
1173
0f37b65fe7c2 server: replaced wrong usage of C.HTTP_UNAUTHORIZED by C.HTTP_FORBIDDEN
Goffi <goffi@goffi.org>
parents: 1145
diff changeset
130 self.pageError(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":
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
134 service, node, event_id, jids, emails = self.getPostedData(
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)
4d1c4bd4931a pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff changeset
140 except RuntimeError as e:
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
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
145 yield self.host.bridgeCall(
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
146 "eventInvite", invitee_jid.userhost(), service, node, event_id, profile
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
1113
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
156 yield self.host.bridgeCall(
cdd389ef97bc server: code style reformatting using black
Goffi <goffi@goffi.org>
parents: 1111
diff changeset
157 "eventInviteByEmail",
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_))