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.
This commit is contained in:
Jan Kaluza
2018-12-10 12:05:51 +01:00
parent 61d8b22fc3
commit 6f43411ea9

View File

@@ -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