Пример #1
0
def supermodel_is_used(configurator, question):
    """Test if supermodel is used."""
    if configurator.variables.get('dexterity_type_supermodel', False):
        raise SkipQuestion(
            u'Skip question, because we need a base class ',
            u'when supermodel ist used.',
        )
Пример #2
0
def git_clean_state_check(configurator, question):
    if not git_support(configurator):
        return
    params = [
        'git',
        'status',
        '--porcelain',
    ]
    echo(u'\nRUN: {0}'.format(' '.join(params)), 'info')
    try:
        result = subprocess.check_output(
            params,
            cwd=configurator.target_directory,
        )
    except subprocess.CalledProcessError as e:
        echo(e.output, 'error')
    else:
        if not result:
            echo('Git state is clean.\n', 'info')
            raise SkipQuestion(
                'Git state is clean, so we skip this question.', )
        echo(
            u'git status result:\n----------------------------\n{0}'.format(
                result, ),
            'warning',
        )
Пример #3
0
def check_view_template_answer(configurator, question):
    if not configurator.variables[
            'view_template'] and not configurator.variables[
                'view_python_class']:  # NOQA: E501
        raise ValidationError(
            u'View must at least have a template or a python class'
        )  # NOQA: E501
    elif not configurator.variables['view_template']:
        raise SkipQuestion(
            u'No view template, so we skip view template name question.'
        )  # NOQA: E501
Пример #4
0
def git_clean_state_check(configurator, question):
    if not git_support(configurator):
        return
    params = ["git", "status", "--porcelain", "--ignore-submodules"]
    echo(u"\nRUN: {0}".format(" ".join(params)), "info")
    try:
        result = subprocess.check_output(params, cwd=configurator.target_directory)
    except subprocess.CalledProcessError as e:
        echo(e.output, "error")
    else:
        if not result:
            echo("Git state is clean.\n", "info")
            raise SkipQuestion("Git state is clean, so we skip this question.")
        echo(
            u"git status result:\n----------------------------\n{0}".format(result),
            "warning",
        )
Пример #5
0
def git_support_enabled(configurator, question):
    disabled = configurator.variables.get('package.git.disabled', u'False')
    if hooks.to_boolean(None, None, disabled):
        echo(u'GIT support disabled!')
        raise SkipQuestion(u'GIT support is disabled, skip question!.')
Пример #6
0
def git_support_enabled(configurator, question):
    disabled = configurator.variables.get("package.git.disabled", u"False")
    if hooks.to_boolean(None, None, disabled):
        echo(u"GIT support disabled!!!")
        raise SkipQuestion(u"GIT support is disabled, skip question!")
Пример #7
0
def check_viewlet_template_answer(configurator, question):
    if not configurator.variables['viewlet_template']:
        raise SkipQuestion(
            u'No view template, so we skip view template name question.'
        )  # NOQA: E501
Пример #8
0
def check_python_class_answer(configurator, question):
    if not configurator.variables['view_python_class']:
        raise SkipQuestion(
            u'No python class, so we skip python class name question.'
        )  # NOQA: E501
Пример #9
0
def check_global_allow(configurator, answer):
    """Skip parent container name if global_allow is true."""
    if configurator.variables.get('dexterity_type_global_allow', False):
        raise SkipQuestion(
            u'global_allow is true, so we skip parent container name question.'
        )  # NOQA: E501
Пример #10
0
def is_container(configurator, question):
    """Test if base class is a container."""
    if configurator.variables['dexterity_type_base_class'] != 'Container':
        raise SkipQuestion(u'Is not a Container, so we skip filter question.')