Mercurial > libervia-web
annotate libervia/pages/events/admin/page_meta.py @ 1124:28e3eb3bb217
files reorganisation and installation rework:
- files have been reorganised to follow other SàT projects and usual Python organisation (no more "/src" directory)
- VERSION file is now used, as for other SàT projects
- replace the overcomplicated setup.py be a more sane one. Pyjamas part is not compiled anymore by setup.py, it must be done separatly
- removed check for data_dir if it's empty
- installation tested working in virtual env
- libervia launching script is now in bin/libervia
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 25 Aug 2018 17:59:48 +0200 |
parents | src/pages/events/admin/page_meta.py@cdd389ef97bc |
children | 29eb15062416 |
rev | line source |
---|---|
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2.7 |
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 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
15 name = u"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 |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 template = u"event/admin.html" |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
18 log = getLogger(u"pages/" + 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 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
39 event_service = template_data[u"event_service"] = data["event_service"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
40 event_node = template_data[u"event_node"] = data["event_node"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
41 event_id = template_data[u"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( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
44 u"eventGet", |
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( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
56 u""" |
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( |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 u"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 |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 for invitee_data in invitees.itervalues(): |
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( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
80 _(u"guests value is not valid: {invitee}").format(invitee=invitee_data) |
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 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
89 data[u"service"] = jid.JID(event_data[u"blog_service"]) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
90 data[u"node"] = event_data[u"blog_node"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
91 data[u"allow_commenting"] = u"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 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
95 blog_page = self.getPageByName(u"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: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 log.error(u"got post data without profile") |
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( |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
108 request, (u"service", u"node", u"title", u"body", u"language") |
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) |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 data = {u"content": body} |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 if title: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
115 data[u"title"] = title |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 if lang: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
117 data[u"language"] = lang |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 try: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
119 comments = bool(self.getPostedData(request, u"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: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
124 data[u"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: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
127 yield self.host.bridgeCall(u"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: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 if u"forbidden" in unicode(e): |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 self.pageError(request, C.HTTP_UNAUTHORIZED) |
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( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
135 request, (u"service", u"node", u"event_id", u"jids", u"emails") |
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( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
142 _(u"this is not a valid jid: {jid}").format(jid=invitee_jid_s) |
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( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
151 _(u"this is not a valid email address: {email}").format( |
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 {}, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
163 u"", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
164 u"", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
165 u"", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
166 u"", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
167 u"", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
168 u"", |
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: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
173 log.warning(_(u"Unhandled data type: {}").format(type_)) |