Mercurial > libervia-web
comparison libervia/pages/merge-requests/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/merge-requests/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.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"merge-requests" | |
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"merge-requests_disco", request) | |
24 if node == u"@": | |
25 node = data[u"node"] = u"" | |
26 self.checkCache( | |
27 request, C.CACHE_PUBSUB, service=service, node=node, short="merge-requests" | |
28 ) | |
29 template_data = request.template_data | |
30 template_data[u"url_tickets_list"] = self.getPageByName("merge-requests").getURL( | |
31 service.full(), node | |
32 ) | |
33 template_data[u"url_tickets_new"] = self.getSubPageURL(request, "merge-requests_new") | |
34 | |
35 | |
36 @defer.inlineCallbacks | |
37 def prepare_render(self, request): | |
38 data = self.getRData(request) | |
39 template_data = request.template_data | |
40 service, node = data[u"service"], data[u"node"] | |
41 profile = self.getProfile(request) or C.SERVICE_PROFILE | |
42 | |
43 merge_requests = yield self.host.bridgeCall( | |
44 "mergeRequestsGet", | |
45 service.full() if service else u"", | |
46 node, | |
47 C.NO_LIMIT, | |
48 [], | |
49 "", | |
50 {"labels_as_list": C.BOOL_TRUE}, | |
51 profile, | |
52 ) | |
53 template_data[u"tickets"] = [ | |
54 template_xmlui.create(self.host, x) for x in merge_requests[0] | |
55 ] | |
56 template_data[u"on_ticket_click"] = data_objects.OnClick( | |
57 url=self.getSubPageURL(request, u"merge-requests_view") + u"/{item.id}" | |
58 ) |