From 36d3fb721529e677a4c758ba4a20a4bf44c6158c Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Thu, 14 Jul 2016 17:59:08 -0400 Subject: [PATCH] Fix some deprecation warnings with newer flask version --- realms/__init__.py | 8 ++++---- realms/commands.py | 2 +- realms/config/__init__.py | 1 + realms/lib/hook.py | 2 +- realms/lib/test.py | 2 +- realms/modules/auth/__init__.py | 2 +- realms/modules/auth/ldap/models.py | 2 +- realms/modules/auth/local/models.py | 2 +- realms/modules/auth/models.py | 2 +- realms/modules/auth/views.py | 2 +- realms/modules/search/models.py | 2 +- realms/modules/wiki/views.py | 2 +- 12 files changed, 15 insertions(+), 14 deletions(-) diff --git a/realms/__init__.py b/realms/__init__.py index 84ea98e..27c63dc 100644 --- a/realms/__init__.py +++ b/realms/__init__.py @@ -13,10 +13,10 @@ import httplib import traceback import click from flask import Flask, request, render_template, url_for, redirect, g -from flask.ext.cache import Cache -from flask.ext.login import LoginManager, current_user -from flask.ext.sqlalchemy import SQLAlchemy -from flask.ext.assets import Environment, Bundle +from flask_cache import Cache +from flask_login import LoginManager, current_user +from flask_sqlalchemy import SQLAlchemy +from flask_assets import Environment, Bundle from flask_ldap_login import LDAPLoginManager from functools import update_wrapper from werkzeug.routing import BaseConverter diff --git a/realms/commands.py b/realms/commands.py index ac228c9..c7ca43c 100644 --- a/realms/commands.py +++ b/realms/commands.py @@ -425,7 +425,7 @@ def clear_cache(): def test(): """ Run tests """ - for mod in [('flask.ext.testing', 'Flask-Testing'), ('nose', 'nose'), ('blinker', 'blinker')]: + for mod in [('flask_testing', 'Flask-Testing'), ('nose', 'nose'), ('blinker', 'blinker')]: if not module_exists(mod[0]): pip.main(['install', mod[1]]) diff --git a/realms/config/__init__.py b/realms/config/__init__.py index 8a3f0b0..9e06a1c 100644 --- a/realms/config/__init__.py +++ b/realms/config/__init__.py @@ -139,6 +139,7 @@ class Config(object): DEBUG = False ASSETS_DEBUG = False SQLALCHEMY_ECHO = False + SQLALCHEMY_TRACK_MODIFICATIONS = False MODULES = ['wiki', 'search', 'auth'] diff --git a/realms/lib/hook.py b/realms/lib/hook.py index 0327263..a607b54 100644 --- a/realms/lib/hook.py +++ b/realms/lib/hook.py @@ -1,4 +1,4 @@ -from flask.ext.sqlalchemy import DeclarativeMeta +from flask_sqlalchemy import DeclarativeMeta from functools import wraps diff --git a/realms/lib/test.py b/realms/lib/test.py index dd5b683..465b6f4 100644 --- a/realms/lib/test.py +++ b/realms/lib/test.py @@ -1,7 +1,7 @@ import os import shutil import tempfile -from flask.ext.testing import TestCase +from flask_testing import TestCase from realms.lib.util import random_string from realms import create_app diff --git a/realms/modules/auth/__init__.py b/realms/modules/auth/__init__.py index a33ffda..b8421e7 100644 --- a/realms/modules/auth/__init__.py +++ b/realms/modules/auth/__init__.py @@ -1,6 +1,6 @@ from realms import login_manager from flask import request, flash, redirect -from flask.ext.login import login_url +from flask_login import login_url modules = set() diff --git a/realms/modules/auth/ldap/models.py b/realms/modules/auth/ldap/models.py index c1c7176..1574eb8 100644 --- a/realms/modules/auth/ldap/models.py +++ b/realms/modules/auth/ldap/models.py @@ -1,5 +1,5 @@ from flask import render_template -from flask.ext.login import login_user +from flask_login import login_user from realms import ldap from flask_ldap_login import LDAPLoginForm from ..models import BaseUser diff --git a/realms/modules/auth/local/models.py b/realms/modules/auth/local/models.py index 695ce63..9e14ec8 100644 --- a/realms/modules/auth/local/models.py +++ b/realms/modules/auth/local/models.py @@ -1,5 +1,5 @@ from flask import current_app, render_template -from flask.ext.login import logout_user, login_user +from flask_login import logout_user, login_user from realms import login_manager, db from realms.lib.model import Model from ..models import BaseUser diff --git a/realms/modules/auth/models.py b/realms/modules/auth/models.py index f62b736..f5a0ec7 100644 --- a/realms/modules/auth/models.py +++ b/realms/modules/auth/models.py @@ -1,5 +1,5 @@ from flask import current_app -from flask.ext.login import UserMixin, logout_user, AnonymousUserMixin +from flask_login import UserMixin, logout_user, AnonymousUserMixin from realms import login_manager from realms.lib.util import gravatar_url from itsdangerous import URLSafeSerializer, BadSignature diff --git a/realms/modules/auth/views.py b/realms/modules/auth/views.py index 8ca607f..1f1b4a0 100644 --- a/realms/modules/auth/views.py +++ b/realms/modules/auth/views.py @@ -1,5 +1,5 @@ from flask import current_app, render_template, request, redirect, Blueprint, flash, url_for -from flask.ext.login import logout_user +from flask_login import logout_user from realms.modules.auth.models import Auth blueprint = Blueprint('auth', __name__) diff --git a/realms/modules/search/models.py b/realms/modules/search/models.py index 5a1a559..2935db7 100644 --- a/realms/modules/search/models.py +++ b/realms/modules/search/models.py @@ -14,7 +14,7 @@ def whoosh(app): def elasticsearch(app): - from flask.ext.elastic import Elastic + from flask_elastic import Elastic fields = app.config.get('ELASTICSEARCH_FIELDS') return ElasticSearch(Elastic(app), fields) diff --git a/realms/modules/wiki/views.py b/realms/modules/wiki/views.py index 87db1d3..dc53308 100644 --- a/realms/modules/wiki/views.py +++ b/realms/modules/wiki/views.py @@ -2,7 +2,7 @@ import itertools import sys from datetime import datetime from flask import abort, g, render_template, request, redirect, Blueprint, flash, url_for, current_app -from flask.ext.login import login_required, current_user +from flask_login import login_required, current_user from realms.lib.util import to_canonical, remove_ext, gravatar_url from .models import PageNotFound