From 0eb489fb8a0fda2a2b864f8c32bf5942e0ddd595 Mon Sep 17 00:00:00 2001 From: Bibhas Date: Sun, 29 Dec 2019 10:54:33 +0530 Subject: [PATCH] Moving to Py3 (#38) * 2to3 changes * updated readme to mention py3 --- README.md | 4 ++-- hgapp/__init__.py | 2 +- hgapp/views/login.py | 10 +++++----- rqinit.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 528e4c4..65a44f3 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ HasGeek App Boilerplate [![Build status](https://secure.travis-ci.org/hasgeek/hgapp.svg)](https://travis-ci.org/hasgeek/hgapp) [![Coverage Status](https://coveralls.io/repos/hasgeek/hgapp/badge.svg)](https://coveralls.io/r/hasgeek/hgapp) -Base template for an app that uses Lastuser, Baseframe and Coaster with Flask and SQLAlchemy. +Base template for an app that uses Lastuser, Baseframe and Coaster with Flask and SQLAlchemy. Supports Python 3+ only. Setup ----- 1. Clone this repository into your development environment. -2. Create a Python virtualenv and activate it. +2. Create a Python 3 virtualenv and activate it. 3. Install requirements: * `pip install -r requirements.txt` * `pip install -r test_requirements.txt` diff --git a/hgapp/__init__.py b/hgapp/__init__.py index cdc0c7c..2e36d67 100644 --- a/hgapp/__init__.py +++ b/hgapp/__init__.py @@ -2,7 +2,7 @@ # The imports in this file are order-sensitive -from __future__ import absolute_import + from flask import Flask from flask_migrate import Migrate diff --git a/hgapp/views/login.py b/hgapp/views/login.py index 97b7365..2930be6 100644 --- a/hgapp/views/login.py +++ b/hgapp/views/login.py @@ -19,7 +19,7 @@ def login(): @app.route('/logout') @lastuser.logout_handler def logout(): - flash(_(u"You are now logged out"), category='success') + flash(_("You are now logged out"), category='success') return get_next_url() @@ -41,13 +41,13 @@ def lastusernotify(user): @lastuser.auth_error_handler def lastuser_error(error, error_description=None, error_uri=None): if error == 'access_denied': - flash(_(u"You denied the request to login"), category='error') + flash(_("You denied the request to login"), category='error') return redirect(get_next_url()) return render_message( - title=_(u"Error: {error}").format(error=error), + title=_("Error: {error}").format(error=error), message=Markup( - u"

{desc}

URI: {uri}

".format( - desc=escape(error_description or u''), uri=escape(error_uri or _(u'NA')) + "

{desc}

URI: {uri}

".format( + desc=escape(error_description or ''), uri=escape(error_uri or _('NA')) ) ), ) diff --git a/rqinit.py b/rqinit.py index a69f6ca..1c47d8c 100644 --- a/rqinit.py +++ b/rqinit.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urlparse import urlparse +from urllib.parse import urlparse from hgapp import app