comparison libervia/pages/tickets/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/tickets/page_meta.py@cdd389ef97bc
children dfd6545a205a
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.tools.common import template_xmlui
7 from sat.tools.common import data_objects
8 from sat.core.log import getLogger
9
10 log = getLogger("pages/ticket")
11 """ticket handling pages"""
12
13 name = u"tickets"
14 access = C.PAGES_ACCESS_PUBLIC
15 template = u"ticket/overview.html"
16
17
18 def parse_url(self, request):
19 self.getPathArgs(request, ["service", "node"], service="jid")
20 data = self.getRData(request)
21 service, node = data[u"service"], data[u"node"]
22 if node is None:
23 self.pageRedirect(u"tickets_disco", request)
24 if node == u"@":
25 node = data[u"node"] = u""
26 template_data = request.template_data
27 template_data[u"url_tickets_list"] = self.getURL(service.full(), node or u"@")
28 template_data[u"url_tickets_new"] = self.getSubPageURL(request, "tickets_new")
29
30
31 @defer.inlineCallbacks
32 def prepare_render(self, request):
33 data = self.getRData(request)
34 template_data = request.template_data
35 service, node = data[u"service"], data[u"node"]
36 profile = self.getProfile(request) or C.SERVICE_PROFILE
37
38 self.checkCache(request, C.CACHE_PUBSUB, service=service, node=node, short="tickets")
39
40 tickets = yield self.host.bridgeCall(
41 "ticketsGet",
42 service.full() if service else u"",
43 node,
44 C.NO_LIMIT,
45 [],
46 "",
47 {"labels_as_list": C.BOOL_TRUE},
48 profile,
49 )
50 template_data[u"tickets"] = [template_xmlui.create(self.host, x) for x in tickets[0]]
51 template_data[u"on_ticket_click"] = data_objects.OnClick(
52 url=self.getSubPageURL(request, u"tickets_view") + u"/{item.id}"
53 )