Commit b72b9578 authored by root's avatar root

Hot fix for mail and alchemy

parent 928194ed
......@@ -4,8 +4,8 @@ A Restful Transfer Server
from __future__ import unicode_literals
from flask import (Flask, jsonify)
from flask.ext.mail import Mail
from flask.ext.sqlalchemy import SQLAlchemy
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy
from multiprocessing import Lock
from werkzeug.exceptions import (default_exceptions, HTTPException)
......@@ -37,18 +37,18 @@ mail = Mail(app)
lock = Lock()
def json_error(ex):
"""
Return JSON encoded error.
"""
response = jsonify(error=str(ex))
response.status_code = (ex.code
if isinstance(ex, HTTPException)
else 500)
return response
for code in default_exceptions.iterkeys():
app.error_handler_spec[None][code] = json_error
#def json_error(ex):
# """
# Return JSON encoded error.
# """
# response = jsonify(error=str(ex))
# response.status_code = (ex.code
# if isinstance(ex, HTTPException)
# else 500)
# return response
#for code in default_exceptions.iterkeys():
# app.error_handler_spec[None][code] = json_error
TRANSFER_INITIATED = 'initiated'
......
......@@ -17,7 +17,7 @@ import smtplib
import sqlalchemy
from datetime import datetime
from flask import (jsonify, render_template, request)
from flask.ext.mail import Message
from flask_mail import Message
from functools import wraps
from werkzeug import secure_filename
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment