Ejemplo n.º 1
0
def init_mediadrop(config_filename, here_dir=None, disable_logging=False):
    if not os.path.exists(config_filename):
        raise IOError('Config file %r does not exist.' % config_filename)
    if here_dir is None:
        here_dir = os.getcwd()
    if not disable_logging:
        logging_config.fileConfig(config_filename)

    conf = appconfig('config:%s' % config_filename, relative_to=here_dir)
    pylons_config = load_environment(conf.global_conf, conf.local_conf)
    paste_registry = Registry()
    paste_registry.prepare()
    pylons_config['paste.registry'] = paste_registry
    
    app_globals = pylons_config['pylons.app_globals']
    register_instance(paste_registry, 'app_globals', app_globals)
    register_instance(paste_registry, 'config', pylons_config)
    fake_request(pylons_config, registry=paste_registry)
    setup_global_translator(registry=paste_registry)
Ejemplo n.º 2
0
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('.'))

import mediadrop

# -- Environment Setup -----------------------------------------------------
# We need a proper request environment to be able to properly import
# controllers and forms for the sake of autodoc.
from mediadrop.lib.test import fake_request, setup_environment_and_database

pylons_config = setup_environment_and_database()
request = fake_request(pylons_config)

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.intersphinx',
    'autodoc_alchemy',
    'autodoc_expose',
]
Ejemplo n.º 3
0
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('.'))

import mediadrop


# -- Environment Setup -----------------------------------------------------
# We need a proper request environment to be able to properly import
# controllers and forms for the sake of autodoc.
from mediadrop.lib.test import fake_request, setup_environment_and_database

pylons_config = setup_environment_and_database()
request = fake_request(pylons_config)

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.intersphinx',
    'autodoc_alchemy',
    'autodoc_expose',
]