Mercurial > libervia-web
diff libervia/pages/merge-requests/view/page_meta.py @ 1216:b2d067339de3
python 3 port:
/!\ Python 3.6+ is now needed to use libervia
/!\ instability may occur and features may not be working anymore, this will improve with time
/!\ TxJSONRPC dependency has been removed
The same procedure as in backend has been applied (check backend commit ab2696e34d29 logs
for details). Removed now deprecated code (Pyjamas compiled browser part, legacy blog,
JSON RPC related code).
Adapted code to work without `html` and `themes` dirs.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 13 Aug 2019 19:12:31 +0200 |
parents | 29eb15062416 |
children | f511f8fbbf8a |
line wrap: on
line diff
--- a/libervia/pages/merge-requests/view/page_meta.py Tue Aug 13 09:39:33 2019 +0200 +++ b/libervia/pages/merge-requests/view/page_meta.py Tue Aug 13 19:12:31 2019 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- from libervia.server.constants import Const as C @@ -12,9 +12,9 @@ from sat.tools.common import data_objects from sat.core.log import getLogger -name = u"merge-requests_view" +name = "merge-requests_view" access = C.PAGES_ACCESS_PUBLIC -template = u"merge-request/item.html" +template = "merge-request/item.html" log = getLogger(__name__) @@ -22,11 +22,11 @@ try: item_id = self.nextPath(request) except IndexError: - log.warning(_(u"no ticket id specified")) + log.warning(_("no ticket id specified")) self.pageError(request, C.HTTP_BAD_REQUEST) data = self.getRData(request) - data[u"ticket_id"] = item_id + data["ticket_id"] = item_id @defer.inlineCallbacks @@ -35,9 +35,9 @@ template_data = request.template_data session = self.host.getSessionData(request, session_iface.ISATSession) service, node, ticket_id = ( - data.get(u"service", u""), - data.get(u"node", u""), - data[u"ticket_id"], + data.get("service", ""), + data.get("node", ""), + data["ticket_id"], ) profile = self.getProfile(request) @@ -46,7 +46,7 @@ tickets, metadata, parsed_tickets = yield self.host.bridgeCall( "mergeRequestsGet", - service.full() if service else u"", + service.full() if service else "", node, C.NO_LIMIT, [ticket_id], @@ -55,7 +55,7 @@ profile, ) ticket = template_xmlui.create(self.host, tickets[0], ignore=["request_data", "type"]) - template_data[u"item"] = ticket + template_data["item"] = ticket template_data["patches"] = parsed_tickets[0] comments_uri = ticket.widgets["comments_uri"].value if comments_uri: @@ -66,8 +66,8 @@ "mbGet", comments_service, comments_node, C.NO_LIMIT, [], {}, profile ) - template_data[u"comments"] = data_objects.BlogItems(comments) - template_data[u"login_url"] = self.getPageRedirectURL(request) + template_data["comments"] = data_objects.BlogItems(comments) + template_data["login_url"] = self.getPageRedirectURL(request) if session.connected: # we set edition URL only if user is the publisher or the node owner @@ -78,10 +78,10 @@ node = node or self.host.ns_map["merge_requests"] affiliation = yield self.host.getAffiliation(request, service, node) if is_publisher or affiliation == "owner": - template_data[u"url_ticket_edit"] = self.getURLByPath( + template_data["url_ticket_edit"] = self.getURLByPath( SubPage("merge-requests"), service.full(), - node or u"@", + node or "@", SubPage("merge-requests_edit"), ticket_id, ) @@ -89,9 +89,9 @@ @defer.inlineCallbacks def on_data_post(self, request): - type_ = self.getPostedData(request, u"type") - if type_ == u"comment": - blog_page = self.getPageByName(u"blog_view") + type_ = self.getPostedData(request, "type") + if type_ == "comment": + blog_page = self.getPageByName("blog_view") yield blog_page.on_data_post(self, request) else: - log.warning(_(u"Unhandled data type: {}").format(type_)) + log.warning(_("Unhandled data type: {}").format(type_))