From 6f43411ea9961c887214ecffde4c7d218c87a2d0 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Dec 10 2018 11:05:51 +0000 Subject: Fix circular dependency between module_build_service.__init__ and module_build_service.backports. This fixes issues with calling 'python module_build_service/manage.py' directly from the MBS git repo as part of testing local module builds without installing MBS. The issue is that 'import pkg_resources' for some reason tries to load module_build_service.backports before the module_build_service.app actually exists. This results in traceback saying that module_build_service.app does not exist. This commit fixes this by importing whole module_build_service in backports.py. --- diff --git a/module_build_service/backports.py b/module_build_service/backports.py index 8e3a94e..1321a67 100644 --- a/module_build_service/backports.py +++ b/module_build_service/backports.py @@ -24,7 +24,7 @@ from flask.json import dumps from flask import request -from module_build_service import app +import module_build_service def jsonify(*args, **kwargs): @@ -35,7 +35,7 @@ def jsonify(*args, **kwargs): indent = None separators = (',', ':') - if app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr: + if module_build_service.app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr: indent = 2 separators = (', ', ': ') @@ -50,7 +50,7 @@ def jsonify(*args, **kwargs): # Note that we add '\n' to end of response # (see https://github.com/mitsuhiko/flask/pull/1262) - rv = app.response_class( + rv = module_build_service.app.response_class( (dumps(data, indent=indent, separators=separators), '\n'), mimetype='application/json') return rv