Mercurial > libervia-web
diff libervia/pages/login/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 | 15f90fd688b5 |
line wrap: on
line diff
--- a/libervia/pages/login/page_meta.py Tue Aug 13 09:39:33 2019 +0200 +++ b/libervia/pages/login/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 sat.core.i18n import _ @@ -12,9 +12,9 @@ """SàT log-in page, with link to create an account""" -name = u"login" +name = "login" access = C.PAGES_ACCESS_PUBLIC -template = u"login/login.html" +template = "login/login.html" def prepare_render(self, request): @@ -59,18 +59,18 @@ type_ = self.getPostedData(request, "type") if type_ == "disconnect": if profile is None: - log.warning(_(u"Disconnect called when no profile is logged")) + log.warning(_("Disconnect called when no profile is logged")) self.pageError(request, C.HTTP_BAD_REQUEST) else: self.host.purgeSession(request) defer.returnValue(C.POST_NO_CONFIRM) elif type_ == "login": - login, password = self.getPostedData(request, (u"login", u"password")) + login, password = self.getPostedData(request, ("login", "password")) try: status = yield self.host.connect(request, login, password) except ValueError as e: - if e.message in (C.XMPP_AUTH_ERROR, C.PROFILE_AUTH_ERROR): - defer.returnValue(login_error(self, request, e.message)) + if str(e) in (C.XMPP_AUTH_ERROR, C.PROFILE_AUTH_ERROR): + defer.returnValue(login_error(self, request, str(e))) else: # this error was not expected! raise e @@ -81,6 +81,6 @@ # Profile has been logged correctly self.redirectOrContinue(request) else: - log.error(_(u"Unhandled status: {status}".format(status=status))) + log.error(_("Unhandled status: {status}".format(status=status))) else: self.pageError(request, C.HTTP_BAD_REQUEST)