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.', )
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', )
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
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", )
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!.')
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!")
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
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
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
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.')