1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Merge pull request #121 from JocelynDelalande/deprecated-default-mail-sender

nicely deprecates DEFAULT_MAIL_SENDER
This commit is contained in:
Alexis Metaireau 2015-05-20 18:03:50 +02:00
commit 84aafc850e
3 changed files with 16 additions and 2 deletions

View file

@ -3,7 +3,7 @@ SQLALCHEMY_DATABASE_URI = 'sqlite:///budget.db'
SQLACHEMY_ECHO = DEBUG SQLACHEMY_ECHO = DEBUG
SECRET_KEY = "tralala" SECRET_KEY = "tralala"
DEFAULT_MAIL_SENDER = ("Budget manager", "budget@notmyidea.org") MAIL_DEFAULT_SENDER = ("Budget manager", "budget@notmyidea.org")
try: try:
from settings import * from settings import *

View file

@ -1,7 +1,7 @@
flask>=0.9 flask>=0.9
flask-wtf==0.8 flask-wtf==0.8
flask-sqlalchemy flask-sqlalchemy
flask-mail flask-mail>=0.8
flask-babel flask-babel
flask-rest flask-rest
jinja2==2.6 jinja2==2.6

View file

@ -1,3 +1,5 @@
import warnings
from flask import Flask, g, request, session from flask import Flask, g, request, session
from flask.ext.babel import Babel from flask.ext.babel import Babel
from raven.contrib.flask import Sentry from raven.contrib.flask import Sentry
@ -9,6 +11,18 @@ from api import api
app = Flask(__name__) app = Flask(__name__)
app.config.from_object("default_settings") app.config.from_object("default_settings")
# Deprecations
if 'DEFAULT_MAIL_SENDER' in app.config:
# Since flask-mail 0.8
warnings.warn(
"DEFAULT_MAIL_SENDER is deprecated in favor of MAIL_DEFAULT_SENDER"
+" and will be removed in further version",
UserWarning
)
if not 'MAIL_DEFAULT_SENDER' in app.config:
app.config['MAIL_DEFAULT_SENDER'] = DEFAULT_MAIL_SENDER
app.register_blueprint(main) app.register_blueprint(main)
app.register_blueprint(api) app.register_blueprint(api)