예제 #1
0
파일: urls.py 프로젝트: nebril/fuel-web
def get_extensions_urls():
    """Method is used to retrieve the data about
    handlers and urls from extensions and convert
    them into web.py consumable format.

    :returns: dict in the next format:
      {'urls': (r'/url/', 'ClassName'),
       'handlers': [{
         'class': ClassName,
         'name': 'ClassName'}]}
    """
    urls = []
    handlers = []
    for extension in get_all_extensions():
        for url in extension.urls:
            # TODO(eli): handler name should be extension specific
            # not to have problems when several extensions use
            # the same name for handler classes.
            # Should be done as a part of blueprint:
            # https://blueprints.launchpad.net/fuel/+spec
            #                                 /volume-manager-refactoring
            handler_name = url['handler'].__name__
            handlers.append({'class': url['handler'], 'name': handler_name})

            urls.extend((url['uri'], handler_name))

    return {'urls': urls, 'handlers': handlers}
예제 #2
0
파일: urls.py 프로젝트: tokumeo/fuel-web
def get_extensions_urls():
    """Method is used to retrieve the data about
    handlers and urls from extensions and convert
    them into web.py consumable format.

    :returns: dict in the next format:
      {'urls': (r'/url/', 'ClassName'),
       'handlers': [{
         'class': ClassName,
         'name': 'ClassName'}]}
    """
    urls = []
    handlers = []
    for extension in get_all_extensions():
        for url in extension.urls:
            # TODO(eli): handler name should be extension specific
            # not to have problems when several extensions use
            # the same name for handler classes.
            # Should be done as a part of blueprint:
            # https://blueprints.launchpad.net/fuel/+spec
            #                                 /volume-manager-refactoring
            handler_name = url['handler'].__name__
            handlers.append({
                'class': url['handler'],
                'name': handler_name})

            urls.extend((url['uri'], handler_name))

    return {'urls': urls, 'handlers': handlers}
예제 #3
0
def do_upgrade_head_extensions():
    from nailgun.extensions import get_all_extensions

    for extension in get_all_extensions():
        if extension.alembic_migrations_path():
            config = make_alembic_config_from_extension(extension)
            do_alembic_command('upgrade', config, 'head')
예제 #4
0
    def validate(cls, data):
        data = set(super(ExtensionValidator, cls).validate(data))
        all_extensions = set(ext.name for ext in get_all_extensions())

        not_found_extensions = data - all_extensions
        if not_found_extensions:
            raise errors.CannotFindExtension("No such extensions: {0}".format(
                ", ".join(sorted(not_found_extensions))))

        return list(data)
예제 #5
0
    def validate(cls, data):
        data = set(super(ExtensionValidator, cls).validate(data))
        all_extensions = set(ext.name for ext in get_all_extensions())

        not_found_extensions = data - all_extensions
        if not_found_extensions:
            raise errors.CannotFindExtension(
                "No such extensions: {0}".format(
                    ", ".join(sorted(not_found_extensions))))

        return data
예제 #6
0
파일: manage.py 프로젝트: mba811/fuel-web
def action_extensions(params):
    from nailgun.logger import logger
    from nailgun.db.migration import action_migrate_alembic_extension
    from nailgun.extensions import get_all_extensions

    for extension in get_all_extensions():
        if extension.alembic_migrations_path():
            logger.info("Running command for extension {0}".format(extension.full_name()))
            action_migrate_alembic_extension(params, extension=extension)
        else:
            logger.info("Extension {0} does not have migrations. " "Skipping...".format(extension.full_name()))
예제 #7
0
def action_extensions(params):
    from nailgun.logger import logger
    from nailgun.db.migration import action_migrate_alembic_extension
    from nailgun.extensions import get_all_extensions

    for extension in get_all_extensions():
        if extension.alembic_migrations_path():
            logger.info('Running command for extension {0}'.format(
                extension.full_name()))
            action_migrate_alembic_extension(params, extension=extension)
        else:
            logger.info('Extension {0} does not have migrations. '
                        'Skipping...'.format(extension.full_name()))
예제 #8
0
    def GET(self):
        """:returns: JSONized list of available extensions.

        :http: * 200 (OK)
        """
        return [ext().to_dict() for ext in get_all_extensions()]
예제 #9
0
    def GET(self):
        """:returns: JSONized list of available extensions.

        :http: * 200 (OK)
        """
        return [ext().to_dict() for ext in get_all_extensions()]