from werkzeug.utils import find_modules, import_string
from flask import Blueprint


def register_all_blueprints(app, blueprint_module):
    if blueprint_module:
        for name in find_modules(blueprint_module, include_packages=True, recursive=True):
            mod = import_string(name)
            for item_name in dir(mod):
                item = getattr(mod, item_name)
                if isinstance(item, Blueprint):
                    app.register_blueprint(item)

@@ -467,8 +467,457 @@
 t(item)%0A
+%0A%0Aclass _Singleton(type):%0A    _instance = %7B%7D%0A    def __call__(cls, *args, **kwargs):%0A        if cls not in cls._instance:%0A            cls._instance%5Bcls%5D = super(_Singleton, cls).__call__(*args, **kwargs)%0A        return cls._instance%5Bcls%5D%0A%0A%0Aclass Singleton(_Singleton('SingletonMeta', (object,), %7B%7D)):%0A    %22%22%22%0A    a singleton implementation, refer to%0A        http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python%0A    %22%22%22%0A    pass%0A

add singleton