Do not reset the driver registry when the 'load_driver' method of

DriverRegistry is executed second time.

Also, initialize the driver before registering different blueprints,
which uses those driver inside them.

Thanks Khushboo for reporting the issue.
This commit is contained in:
Ashesh Vashi 2016-04-25 15:33:48 +05:30
parent 52aa32a4d2
commit 26e9ceaf48
2 changed files with 7 additions and 5 deletions

View File

@ -201,6 +201,9 @@ def create_app(app_name=config.APP_NAME):
from setup import do_upgrade
do_upgrade(app, user_datastore, security, version)
# Load all available serve drivers
driver.init_app(app)
##########################################################################
# Load plugin modules
##########################################################################
@ -252,9 +255,6 @@ def create_app(app_name=config.APP_NAME):
'current_blueprint': current_blueprint
}
# Load all available serve drivers
driver.init_app(app)
##########################################################################
# All done!
##########################################################################

View File

@ -46,7 +46,7 @@ class DriverRegistry(ABCMeta):
- Use this function from init_app(...) to load all available drivers in
the registry.
"""
registry = dict()
registry = None
drivers = dict()
def __init__(cls, name, bases, d):
@ -76,6 +76,8 @@ class DriverRegistry(ABCMeta):
@classmethod
def load_drivers(cls):
# Initialize the registry only if it has not yet been initialized
if DriverRegistry.registry is None:
DriverRegistry.registry = dict()
from importlib import import_module