# Path: fedoracommunity/config/app_cfg.py
# class FedoraCommunityConfig(AppConfig):
#     def add_tosca2_middleware(self, app):
# 
# Path: fedoracommunity/config/environment.py



from fedoracommunity.config.app_cfg import base_config
from fedoracommunity.config.environment import load_environment
    from moksha.wsgi.middleware import make_moksha_middleware
    from fedoracommunity.connectors.api.mw import FCommConnectorMiddleware
        from repoze.squeeze.processor import ResourceSqueezingMiddleware
        from repoze.profile.profiler import AccumulatingProfileMiddleware
import tg


try:
    tg_version_tuple = tuple(map(int, tg.__version__.split('.')[:2]))
except ValueError:
    tg_version_tuple = tuple(tg.__version__.split('.')[:2])

make_base_app = base_config.setup_tg_wsgi_app(load_environment)


def make_app(global_conf, full_stack=True, **app_conf):

    def make_middleware(app):
        if tg_version_tuple < (2, 1):
            app = base_config.add_tosca2_middleware(app)

        app = FCommConnectorMiddleware(app)
        app = make_moksha_middleware(app, tg.config)
        return app

    if tg_version_tuple >= (2, 1):
        app_conf['custom_tw2_config'] = {
            'script_name': global_conf.get('fedoracommunity.script_name', '/')
        }

    app = make_base_app(global_conf,
                        wrap_app=make_middleware,
                        full_stack=full_stack,
                        **app_conf)


# Path: fedoracommunity/config/app_cfg.py
# class FedoraCommunityConfig(AppConfig):
#     def add_tosca2_middleware(self, app):
# 
# Path: fedoracommunity/config/environment.py



# Path: fedoracommunity/config/middleware.py
from fedoracommunity.config.app_cfg import base_config
from fedoracommunity.config.environment import load_environment
    from moksha.wsgi.middleware import make_moksha_middleware
    from fedoracommunity.connectors.api.mw import FCommConnectorMiddleware
        from repoze.squeeze.processor import ResourceSqueezingMiddleware
        from repoze.profile.profiler import AccumulatingProfileMiddleware
import tg



try:
    tg_version_tuple = tuple(map(int, tg.__version__.split('.')[:2]))
except ValueError:
    tg_version_tuple = tuple(tg.__version__.split('.')[:2])

make_base_app = base_config.setup_tg_wsgi_app(load_environment)


def make_app(global_conf, full_stack=True, **app_conf):

    def make_middleware(app):
        if tg_version_tuple < (2, 1):
            app = base_config.add_tosca2_middleware(app)

        app = FCommConnectorMiddleware(app)
        app = make_moksha_middleware(app, tg.config)
        return app

    if tg_version_tuple >= (2, 1):
        app_conf['custom_tw2_config'] = {
            'script_name': global_conf.get('fedoracommunity.script_name', '/')
        }

    app = make_base_app(global_conf,
                        wrap_app=make_middleware,
                        full_stack=full_stack,
                        **app_conf)


    if base_config.squeeze: