From 1983383071db6118583e7fd734e1c6a870e9b6e2 Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Fri, 10 Jul 2020 12:57:40 +0200 Subject: [PATCH] [conf] update code according to CONFIG in config.py --- halfapi/lib/acl_caller_middleware.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/halfapi/lib/acl_caller_middleware.py b/halfapi/lib/acl_caller_middleware.py index 8912732..8d583f4 100644 --- a/halfapi/lib/acl_caller_middleware.py +++ b/halfapi/lib/acl_caller_middleware.py @@ -6,6 +6,7 @@ from starlette.middleware.base import BaseHTTPMiddleware from starlette.routing import Match, Mount from starlette.types import ASGIApp, Receive, Scope, Send +from halfapi.config import CONFIG from halfapi.models.api.view.acl import Acl as AclView class DebugRouteException(Exception): @@ -37,10 +38,6 @@ def match_route(app: ASGIApp, scope: Scope): table. """ - print('3') - from ..app import CONFIG - print(CONFIG) - result = { 'domain': None, 'name': None, @@ -118,6 +115,7 @@ class AclCallerMiddleware(BaseHTTPMiddleware): Response """ print('Hit AclCallerMiddleware of API') + if scope['type'] != 'http': await self.app(scope, receive, send) return @@ -155,4 +153,7 @@ class AclCallerMiddleware(BaseHTTPMiddleware): else: scope['acls'] = [] - return await self.app(scope, receive, send) + elif CONFIG['DEBUG']: + scope['dev_route'] = True + + res = await self.app(scope, receive, send)