Do not set dotted attributes on flask.ext

This commit is contained in:
Armin Ronacher 2011-09-18 12:22:42 +02:00
parent e8020e2c5c
commit 9df2aefd7f
2 changed files with 7 additions and 1 deletions

View file

@ -58,7 +58,8 @@ class _ExtensionImporter(object):
except ImportError:
continue
module = modules[fullname] = modules[realname]
setattr(modules[__name__], modname, module)
if '.' not in modname:
setattr(modules[__name__], modname, module)
return module
raise ImportError(fullname)

View file

@ -31,6 +31,11 @@ class ExtImportHookTestCase(FlaskTestCase):
import_hooks += 1
self.assert_equal(import_hooks, 1)
def teardown(self):
from flask import ext
for key in ext.__dict__:
self.assert_('.' not in key)
def test_flaskext_new_simple_import_normal(self):
from flask.ext.newext_simple import ext_id
self.assert_equal(ext_id, 'newext_simple')