From 0248f64501b14cf07ecb3334b32277dacd86f729 Mon Sep 17 00:00:00 2001 From: nggit Date: Tue, 11 Feb 2025 22:20:46 +0700 Subject: [PATCH 1/4] expose app object --- examples/import.py | 4 ++-- httpout/httpout.py | 4 +--- tests/test_http.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/import.py b/examples/import.py index 01628da..cb3883b 100644 --- a/examples/import.py +++ b/examples/import.py @@ -1,3 +1,3 @@ -from httpout import globals, context # noqa: F401 -from httpout import app # noqa: F401 +from httpout import globals, context, app # noqa: F401 +from httpout import foo # noqa: F401 diff --git a/httpout/httpout.py b/httpout/httpout.py index 5144f5b..56c638a 100644 --- a/httpout/httpout.py +++ b/httpout/httpout.py @@ -134,9 +134,7 @@ def ho_import(name, globals=None, locals=None, fromlist=(), level=0): module.__dict__[child] = module.__server__[ child ] - elif child in worker and ( - child != 'app' or - '__server__' not in globals): + elif child in worker: module.__dict__[child] = worker[child] else: raise ImportError( diff --git a/tests/test_http.py b/tests/test_http.py index d5b5188..6ace667 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -82,7 +82,7 @@ def test_import_error(self): ) self.assertEqual( body, - b'5B\r\n