Mercurial > libervia-web
annotate libervia/pages/events/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/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 sat.core.i18n import _ |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 from sat.core.log import getLogger |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
8 |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
9 log = getLogger("pages/ticket") |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 """ticket handling pages""" |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
12 name = u"events" |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 access = C.PAGES_ACCESS_PUBLIC |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 template = u"event/overview.html" |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 @defer.inlineCallbacks |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 def parse_url(self, request): |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 profile = self.getProfile(request) |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 template_data = request.template_data |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
21 template_data[u"url_event_new"] = self.getSubPageURL(request, "event_new") |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 if profile is not None: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 try: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 events = yield self.host.bridgeCall("eventsList", "", "", profile) |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 except Exception: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 log.warning(_(u"Can't get events list for {profile}").format(profile=profile)) |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 else: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 own_events = [] |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 other_events = [] |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 for event in events: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
31 if C.bool(event.get("creator", C.BOOL_FALSE)): |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 own_events.append(event) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
33 event["url"] = self.getSubPageURL( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
34 request, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
35 u"event_admin", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
36 event.get("service", ""), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
37 event.get("node", ""), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
38 event.get("item"), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
39 ) |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 else: |
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 other_events.append(event) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
42 event["url"] = self.getSubPageURL( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
43 request, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
44 u"event_rsvp", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
45 event.get("service", ""), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
46 event.get("node", ""), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
47 event.get("item"), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
48 ) |
1111
4d1c4bd4931a
pages (events): added root, admin, new, rsvp and view pages
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
50 template_data[u"events"] = own_events + other_events |