comparison 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
comparison
equal deleted inserted replaced
1123:63a4b8fe9782 1124:28e3eb3bb217
1 #!/usr/bin/env python2.7
2 # -*- coding: utf-8 -*-
3
4 from libervia.server.constants import Const as C
5 from twisted.internet import defer
6 from sat.core.i18n import _
7 from sat.core.log import getLogger
8
9 log = getLogger("pages/ticket")
10 """ticket handling pages"""
11
12 name = u"events"
13 access = C.PAGES_ACCESS_PUBLIC
14 template = u"event/overview.html"
15
16
17 @defer.inlineCallbacks
18 def parse_url(self, request):
19 profile = self.getProfile(request)
20 template_data = request.template_data
21 template_data[u"url_event_new"] = self.getSubPageURL(request, "event_new")
22 if profile is not None:
23 try:
24 events = yield self.host.bridgeCall("eventsList", "", "", profile)
25 except Exception:
26 log.warning(_(u"Can't get events list for {profile}").format(profile=profile))
27 else:
28 own_events = []
29 other_events = []
30 for event in events:
31 if C.bool(event.get("creator", C.BOOL_FALSE)):
32 own_events.append(event)
33 event["url"] = self.getSubPageURL(
34 request,
35 u"event_admin",
36 event.get("service", ""),
37 event.get("node", ""),
38 event.get("item"),
39 )
40 else:
41 other_events.append(event)
42 event["url"] = self.getSubPageURL(
43 request,
44 u"event_rsvp",
45 event.get("service", ""),
46 event.get("node", ""),
47 event.get("item"),
48 )
49
50 template_data[u"events"] = own_events + other_events