__init__.py 871 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. """
  3. flask.ext
  4. ~~~~~~~~~
  5. Redirect imports for extensions. This module basically makes it possible
  6. for us to transition from flaskext.foo to flask_foo without having to
  7. force all extensions to upgrade at the same time.
  8. When a user does ``from flask.ext.foo import bar`` it will attempt to
  9. import ``from flask_foo import bar`` first and when that fails it will
  10. try to import ``from flaskext.foo import bar``.
  11. We're switching from namespace packages because it was just too painful for
  12. everybody involved.
  13. :copyright: (c) 2015 by Armin Ronacher.
  14. :license: BSD, see LICENSE for more details.
  15. """
  16. def setup():
  17. from ..exthook import ExtensionImporter
  18. importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], __name__)
  19. importer.install()
  20. setup()
  21. del setup