Browse Source

Do not set dotted attributes on flask.ext

pull/325/head
Armin Ronacher 13 years ago
parent
commit
9df2aefd7f
  1. 1
      flask/ext/__init__.py
  2. 5
      flask/testsuite/ext.py

1
flask/ext/__init__.py

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

5
flask/testsuite/ext.py

@ -31,6 +31,11 @@ class ExtImportHookTestCase(FlaskTestCase):
import_hooks += 1 import_hooks += 1
self.assert_equal(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): def test_flaskext_new_simple_import_normal(self):
from flask.ext.newext_simple import ext_id from flask.ext.newext_simple import ext_id
self.assert_equal(ext_id, 'newext_simple') self.assert_equal(ext_id, 'newext_simple')

Loading…
Cancel
Save