From e8ea69364eace4ee0ad87c779bfaf20b0bc353ac Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Thu, 28 Aug 2014 17:21:49 -0300 Subject: moving user agent initialization (mail service, leap_session, app_config) to inside setup so it doesn't happen in the tests --- service/pixelated/user_agent.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/service/pixelated/user_agent.py b/service/pixelated/user_agent.py index 3e9eadaf..9626f739 100644 --- a/service/pixelated/user_agent.py +++ b/service/pixelated/user_agent.py @@ -32,9 +32,7 @@ static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", ". if not os.path.exists(static_folder): static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "app")) app = Flask(__name__, static_url_path='', static_folder=static_folder) -app.config.from_pyfile(os.path.join(os.environ['HOME'], '.pixelated')) -leap_session = open_leap_session(app.config['LEAP_USERNAME'], app.config['LEAP_PASSWORD'], app.config['LEAP_SERVER_NAME']) -mail_service = MailService(leap_session) + def respond_json(entity): @@ -143,6 +141,10 @@ def index(): def setup(): debug_enabled = os.environ.get('DEBUG', False) reactor_manager.start_reactor(logging=debug_enabled) + app.config.from_pyfile(os.path.join(os.environ['HOME'], '.pixelated')) + leap_session = open_leap_session(app.config['LEAP_USERNAME'], app.config['LEAP_PASSWORD'], app.config['LEAP_SERVER_NAME']) + mail_service = MailService(leap_session) + global mail_service mail_service.start() app.run(host=app.config['HOST'], debug=debug_enabled, port=app.config['PORT']) -- cgit v1.2.3