From f9927f4f3d78c50fd98979a0fbe82a6b9f0f1cd3 Mon Sep 17 00:00:00 2001 From: ilvalle Date: Fri, 15 Jul 2016 20:34:27 +0200 Subject: [PATCH] fix local import for contrib modules --- gluon/custom_import.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gluon/custom_import.py b/gluon/custom_import.py index 8e848626..ef6c7ab2 100644 --- a/gluon/custom_import.py +++ b/gluon/custom_import.py @@ -62,6 +62,9 @@ def custom_importer(name, globals=None, locals=None, fromlist=None, level=-1): except: # there is no current.request (should never happen) base_importer = NATIVE_IMPORTER + if not(PY2) and level < 0: + level = 0 + # if not relative and not from applications: if hasattr(current, 'request') \ and level <= 0 \ @@ -104,9 +107,6 @@ def custom_importer(name, globals=None, locals=None, fromlist=None, level=-1): finally: if import_tb: import_tb = None - elif not(PY2) and level < 0: - # FIXME PY3 why level is < 0? - level = 0 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)