コード例 #1
0
def install_package(app, module, init_func, raise_exc=False, log_exc=True):
    """Installs a Python package like a product."""
    from App.ProductContext import ProductContext
    try:
        do_install = doInstall()
        name = module.__name__
        if do_install:
            product = App.Product.initializeProduct(module, name,
                                                    module.__path__[0], app)
        else:
            product = FactoryDispatcher.Product(name)
            app = None

        product.package_name = name

        if init_func is not None:
            newContext = ProductContext(product, app, module)
            init_func(newContext)

        package_initialized(module, init_func)

        if do_install:
            transaction.get().note('Installed package %s' % module.__name__)
            transaction.commit()
    except Exception:
        if log_exc:
            LOG.error("Couldn't install %s" % module.__name__, exc_info=True)
        transaction.abort()
        if raise_exc:
            raise
コード例 #2
0
def install_package(app, module, init_func, raise_exc=False, log_exc=True):
    """Installs a Python package like a product."""
    from App.ProductContext import ProductContext
    try:
        do_install = doInstall()
        name = module.__name__
        if do_install:
            product = App.Product.initializeProduct(module,
                                                    name,
                                                    module.__path__[0],
                                                    app)
        else:
            product = FactoryDispatcher.Product(name)
            app = None

        product.package_name = name

        if init_func is not None:
            newContext = ProductContext(product, app, module)
            init_func(newContext)

        package_initialized(module, init_func)

        if do_install:
            transaction.get().note('Installed package %s' % module.__name__)
            transaction.commit()
    except Exception:
        if log_exc:
            LOG.error("Couldn't install %s" % module.__name__,
                      exc_info=True)
        transaction.abort()
        if raise_exc:
            raise
コード例 #3
0
def install_package(app, module, init_func, raise_exc=None):
    """Installs a Python package like a product."""
    name = module.__name__
    product = FactoryDispatcher.Product(name)
    product.package_name = name

    if init_func is not None:
        newContext = ProductContext(product, app, module)
        init_func(newContext)

    package_initialized(module, init_func)
コード例 #4
0
ファイル: Application.py プロジェクト: dhavlik/Zope
def install_package(app, module, init_func, raise_exc=None):
    """Installs a Python package like a product."""
    name = module.__name__
    product = FactoryDispatcher.Product(name)
    product.package_name = name

    if init_func is not None:
        newContext = ProductContext(product, app, module)
        init_func(newContext)

    package_initialized(module, init_func)