forked from orbit-oss/flask
importlib deprecated in 3.5.
Replace the use of importlib by types.ModuleType that seem to be available since at least 2.6 closes gh-1449
This commit is contained in:
parent
73c833568d
commit
2de525c720
2 changed files with 4 additions and 4 deletions
|
|
@ -9,8 +9,8 @@
|
||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import imp
|
|
||||||
import os
|
import os
|
||||||
|
import types
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
from werkzeug.utils import import_string
|
from werkzeug.utils import import_string
|
||||||
|
|
@ -123,7 +123,7 @@ class Config(dict):
|
||||||
`silent` parameter.
|
`silent` parameter.
|
||||||
"""
|
"""
|
||||||
filename = os.path.join(self.root_path, filename)
|
filename = os.path.join(self.root_path, filename)
|
||||||
d = imp.new_module('config')
|
d = types.ModuleType('config')
|
||||||
d.__file__ = filename
|
d.__file__ = filename
|
||||||
try:
|
try:
|
||||||
with open(filename) as config_file:
|
with open(filename) as config_file:
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@
|
||||||
:copyright: (c) 2015 by Armin Ronacher.
|
:copyright: (c) 2015 by Armin Ronacher.
|
||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
import types
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import imp
|
|
||||||
|
|
||||||
|
|
||||||
class ExtensionImporter(object):
|
class ExtensionImporter(object):
|
||||||
|
|
@ -118,7 +118,7 @@ class ExtensionImporter(object):
|
||||||
|
|
||||||
def activate():
|
def activate():
|
||||||
import flask
|
import flask
|
||||||
ext_module = imp.new_module('flask.ext')
|
ext_module = types.ModuleType('flask.ext')
|
||||||
ext_module.__path__ = []
|
ext_module.__path__ = []
|
||||||
flask.ext = sys.modules['flask.ext'] = ext_module
|
flask.ext = sys.modules['flask.ext'] = ext_module
|
||||||
importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], 'flask.ext')
|
importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], 'flask.ext')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue