aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-05-29 22:58:20 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-05-29 22:58:20 +0200
commitb0049442eee94a1636490c091215bd706f819558 (patch)
treee44b18eddfcc0134ed4fc2b38821740617fac694
parentBugfix: it was not possible to delete a user with categories. (diff)
downloadnewspipe-b0049442eee94a1636490c091215bd706f819558.tar.gz
newspipe-b0049442eee94a1636490c091215bd706f819558.tar.bz2
newspipe-b0049442eee94a1636490c091215bd706f819558.zip
Fixed some depreciations with the new version of Flask.
-rw-r--r--src/bootstrap.py6
-rwxr-xr-xsrc/manager.py6
-rwxr-xr-xsrc/runserver.py5
-rw-r--r--src/web/decorators.py2
-rw-r--r--src/web/forms.py6
-rw-r--r--src/web/models/user.py2
-rw-r--r--src/web/views/admin.py4
-rw-r--r--src/web/views/api/v2/article.py2
-rw-r--r--src/web/views/api/v2/category.py2
-rw-r--r--src/web/views/api/v2/common.py4
-rw-r--r--src/web/views/api/v2/feed.py2
-rw-r--r--src/web/views/api/v3/article.py4
-rw-r--r--src/web/views/api/v3/common.py4
-rw-r--r--src/web/views/api/v3/feed.py2
-rw-r--r--src/web/views/article.py4
-rw-r--r--src/web/views/category.py4
-rw-r--r--src/web/views/common.py4
-rw-r--r--src/web/views/feed.py4
-rw-r--r--src/web/views/home.py4
-rw-r--r--src/web/views/session_mgmt.py6
-rw-r--r--src/web/views/user.py4
-rw-r--r--src/web/views/views.py2
22 files changed, 41 insertions, 42 deletions
diff --git a/src/bootstrap.py b/src/bootstrap.py
index 2c5f9951..146d9176 100644
--- a/src/bootstrap.py
+++ b/src/bootstrap.py
@@ -6,7 +6,7 @@
import os
import conf
import logging
-import flask.ext.restless
+import flask_restless
from urllib.parse import urlsplit
def set_logging(log_path, log_level=logging.INFO,
@@ -20,7 +20,7 @@ def set_logging(log_path, log_level=logging.INFO,
logger.setLevel(log_level)
from flask import Flask
-from flask.ext.sqlalchemy import SQLAlchemy
+from flask_sqlalchemy import SQLAlchemy
# Create Flask application
application = Flask('web')
@@ -53,7 +53,7 @@ if not application.config['SECURITY_PASSWORD_SALT']:
db = SQLAlchemy(application)
# Create the Flask-Restless API manager.
-manager = flask.ext.restless.APIManager(application, flask_sqlalchemy_db=db)
+manager = flask_restless.APIManager(application, flask_sqlalchemy_db=db)
def populate_g():
from flask import g
diff --git a/src/manager.py b/src/manager.py
index d5e91d70..98161555 100755
--- a/src/manager.py
+++ b/src/manager.py
@@ -5,8 +5,8 @@ import os
import logging
from werkzeug import generate_password_hash
from bootstrap import application, db, conf
-from flask.ext.script import Manager
-from flask.ext.migrate import Migrate, MigrateCommand
+from flask_script import Manager
+from flask_migrate import Migrate, MigrateCommand
import web.models
from web.controllers import FeedController, UserController
@@ -54,7 +54,7 @@ def fetch_asyncio(user_id, feed_id):
import asyncio
with application.app_context():
- from flask.ext.login import current_user
+ from flask_login import current_user
from crawler import classic_crawler
ucontr = UserController()
users = []
diff --git a/src/runserver.py b/src/runserver.py
index 0429449f..c7bdbff9 100755
--- a/src/runserver.py
+++ b/src/runserver.py
@@ -20,8 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import calendar
from bootstrap import conf, application, populate_g
-from flask.ext.babel import Babel
-from flask.ext.babel import format_datetime
+from flask_babel import Babel, format_datetime
if conf.ON_HEROKU:
from flask_sslify import SSLify
@@ -37,7 +36,7 @@ application.jinja_env.filters['datetime'] = format_datetime
application.jinja_env.globals['conf'] = conf
# Views
-from flask.ext.restful import Api
+from flask_restful import Api
from flask import g
with application.app_context():
diff --git a/src/web/decorators.py b/src/web/decorators.py
index 95177f6e..83a06a48 100644
--- a/src/web/decorators.py
+++ b/src/web/decorators.py
@@ -4,7 +4,7 @@
from threading import Thread
from functools import wraps
-from flask.ext.login import login_required
+from flask_login import login_required
def async(f):
diff --git a/src/web/forms.py b/src/web/forms.py
index c0526512..e73cfb98 100644
--- a/src/web/forms.py
+++ b/src/web/forms.py
@@ -27,12 +27,12 @@ __copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
from flask import flash, url_for, redirect
-from flask.ext.wtf import Form
-from flask.ext.babel import lazy_gettext
+from flask_wtf import Form
+from flask_babel import lazy_gettext
from werkzeug.exceptions import NotFound
from wtforms import TextField, TextAreaField, PasswordField, BooleanField, \
SubmitField, IntegerField, SelectField, validators, HiddenField
-from flask.ext.wtf.html5 import EmailField
+from flask_wtf.html5 import EmailField
from web.lib import misc_utils
from web.controllers import UserController
diff --git a/src/web/models/user.py b/src/web/models/user.py
index 08279c7e..e8ac1d3b 100644
--- a/src/web/models/user.py
+++ b/src/web/models/user.py
@@ -31,7 +31,7 @@ import random
import hashlib
from datetime import datetime
from werkzeug import check_password_hash
-from flask.ext.login import UserMixin
+from flask_login import UserMixin
from bootstrap import db
from web.models.right_mixin import RightMixin
diff --git a/src/web/views/admin.py b/src/web/views/admin.py
index d7ec211f..9703894e 100644
--- a/src/web/views/admin.py
+++ b/src/web/views/admin.py
@@ -1,7 +1,7 @@
from datetime import datetime
from flask import (Blueprint, render_template, redirect, flash, url_for)
-from flask.ext.babel import gettext, format_timedelta
-from flask.ext.login import login_required, current_user
+from flask_babel import gettext, format_timedelta
+from flask_login import login_required, current_user
from werkzeug import generate_password_hash
from web.views.common import admin_permission
diff --git a/src/web/views/api/v2/article.py b/src/web/views/api/v2/article.py
index 71201538..2be286c6 100644
--- a/src/web/views/api/v2/article.py
+++ b/src/web/views/api/v2/article.py
@@ -2,7 +2,7 @@ from conf import API_ROOT
import dateutil.parser
from datetime import datetime
from flask import current_app
-from flask.ext.restful import Api
+from flask_restful import Api
from web.views.common import api_permission
from web.controllers import ArticleController
diff --git a/src/web/views/api/v2/category.py b/src/web/views/api/v2/category.py
index 21459fc5..70fda1ea 100644
--- a/src/web/views/api/v2/category.py
+++ b/src/web/views/api/v2/category.py
@@ -1,6 +1,6 @@
from conf import API_ROOT
from flask import current_app
-from flask.ext.restful import Api
+from flask_restful import Api
from web.controllers.category import CategoryController
from web.views.api.v2.common import (PyAggResourceNew,
diff --git a/src/web/views/api/v2/common.py b/src/web/views/api/v2/common.py
index 0227d6cf..04b19d78 100644
--- a/src/web/views/api/v2/common.py
+++ b/src/web/views/api/v2/common.py
@@ -23,8 +23,8 @@ import logging
from functools import wraps
from werkzeug.exceptions import Unauthorized, BadRequest, Forbidden, NotFound
from flask import request
-from flask.ext.restful import Resource, reqparse
-from flask.ext.login import current_user
+from flask_restful import Resource, reqparse
+from flask_login import current_user
from web.views.common import admin_permission, api_permission, \
login_user_bundle, jsonify
diff --git a/src/web/views/api/v2/feed.py b/src/web/views/api/v2/feed.py
index 686dcd76..a5561475 100644
--- a/src/web/views/api/v2/feed.py
+++ b/src/web/views/api/v2/feed.py
@@ -1,6 +1,6 @@
from conf import API_ROOT
from flask import current_app
-from flask.ext.restful import Api
+from flask_restful import Api
from web.views.common import api_permission
from web.controllers.feed import (FeedController,
diff --git a/src/web/views/api/v3/article.py b/src/web/views/api/v3/article.py
index 4f9bbb8b..9a4df1ce 100644
--- a/src/web/views/api/v3/article.py
+++ b/src/web/views/api/v3/article.py
@@ -26,9 +26,9 @@ __revision__ = "$Date: 2016/04/29 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
-from flask.ext.login import current_user
+from flask_login import current_user
from werkzeug.exceptions import NotFound
-from flask.ext.restless import ProcessingException
+from flask_restless import ProcessingException
from web import models
from bootstrap import application, manager
from web.controllers import ArticleController, FeedController
diff --git a/src/web/views/api/v3/common.py b/src/web/views/api/v3/common.py
index 05ce7057..84e3da0d 100644
--- a/src/web/views/api/v3/common.py
+++ b/src/web/views/api/v3/common.py
@@ -27,8 +27,8 @@ __copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
from flask import request
-from flask.ext.login import current_user
-from flask.ext.restless import ProcessingException
+from flask_login import current_user
+from flask_restless import ProcessingException
from werkzeug.exceptions import NotFound
from web.controllers import ArticleController, UserController
from web.views.common import login_user_bundle
diff --git a/src/web/views/api/v3/feed.py b/src/web/views/api/v3/feed.py
index 1c32929f..cc9f5cad 100644
--- a/src/web/views/api/v3/feed.py
+++ b/src/web/views/api/v3/feed.py
@@ -26,7 +26,7 @@ __revision__ = "$Date: 2016/04/29 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
-from flask.ext.login import current_user
+from flask_login import current_user
from web import models
from bootstrap import application, manager
from web.controllers import FeedController
diff --git a/src/web/views/article.py b/src/web/views/article.py
index fea4aa06..eed9a9d3 100644
--- a/src/web/views/article.py
+++ b/src/web/views/article.py
@@ -2,8 +2,8 @@ from datetime import datetime, timedelta
from flask import (Blueprint, g, render_template, redirect,
flash, url_for, make_response, request)
-from flask.ext.babel import gettext
-from flask.ext.login import login_required, current_user
+from flask_babel import gettext
+from flask_login import login_required, current_user
from bootstrap import db
diff --git a/src/web/views/category.py b/src/web/views/category.py
index c54ebe9b..1a81a5c4 100644
--- a/src/web/views/category.py
+++ b/src/web/views/category.py
@@ -1,6 +1,6 @@
from flask import Blueprint, render_template, flash, redirect, url_for
-from flask.ext.babel import gettext
-from flask.ext.login import login_required, current_user
+from flask_babel import gettext
+from flask_login import login_required, current_user
from web.forms import CategoryForm
from web.lib.utils import redirect_url
diff --git a/src/web/views/common.py b/src/web/views/common.py
index 690c4d1c..f9613c01 100644
--- a/src/web/views/common.py
+++ b/src/web/views/common.py
@@ -2,8 +2,8 @@ import json
from functools import wraps
from datetime import datetime
from flask import current_app, Response
-from flask.ext.login import login_user
-from flask.ext.principal import (Identity, Permission, RoleNeed,
+from flask_login import login_user
+from flask_principal import (Identity, Permission, RoleNeed,
session_identity_loader, identity_changed)
from web.controllers import UserController
from web.lib.utils import default_handler
diff --git a/src/web/views/feed.py b/src/web/views/feed.py
index b49495f3..6338f320 100644
--- a/src/web/views/feed.py
+++ b/src/web/views/feed.py
@@ -6,8 +6,8 @@ from werkzeug.exceptions import BadRequest
from flask import Blueprint, render_template, flash, \
redirect, request, url_for
-from flask.ext.babel import gettext
-from flask.ext.login import login_required, current_user
+from flask_babel import gettext
+from flask_login import login_required, current_user
import conf
from web.lib import misc_utils, utils
diff --git a/src/web/views/home.py b/src/web/views/home.py
index f53299dc..179f3f9d 100644
--- a/src/web/views/home.py
+++ b/src/web/views/home.py
@@ -4,8 +4,8 @@ from datetime import datetime
from flask import current_app, render_template, \
request, flash, url_for, redirect
-from flask.ext.login import login_required, current_user
-from flask.ext.babel import gettext, get_locale
+from flask_login import login_required, current_user
+from flask_babel import gettext, get_locale
from babel.dates import format_datetime, format_timedelta
import conf
diff --git a/src/web/views/session_mgmt.py b/src/web/views/session_mgmt.py
index a3ef8e3c..876efd3d 100644
--- a/src/web/views/session_mgmt.py
+++ b/src/web/views/session_mgmt.py
@@ -5,10 +5,10 @@ from werkzeug import generate_password_hash
from werkzeug.exceptions import NotFound
from flask import (render_template, flash, session, request,
url_for, redirect, current_app)
-from flask.ext.babel import gettext
-from flask.ext.login import LoginManager, logout_user, \
+from flask_babel import gettext
+from flask_login import LoginManager, logout_user, \
login_required, current_user
-from flask.ext.principal import (Principal, AnonymousIdentity, UserNeed,
+from flask_principal import (Principal, AnonymousIdentity, UserNeed,
identity_changed, identity_loaded,
session_identity_loader)
diff --git a/src/web/views/user.py b/src/web/views/user.py
index 3928f5dc..229530d1 100644
--- a/src/web/views/user.py
+++ b/src/web/views/user.py
@@ -2,8 +2,8 @@ import string
import random
from flask import (Blueprint, g, render_template, redirect,
flash, url_for, request)
-from flask.ext.babel import gettext
-from flask.ext.login import login_required, current_user
+from flask_babel import gettext
+from flask_login import login_required, current_user
import conf
from notifications import notifications
diff --git a/src/web/views/views.py b/src/web/views/views.py
index b23a41a1..a7c842d7 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -1,7 +1,7 @@
import logging
from flask import (request, render_template, flash,
url_for, redirect, current_app)
-from flask.ext.babel import gettext
+from flask_babel import gettext
from conf import API_ROOT
from web.lib.view_utils import etag_match
bgstack15