diff --git a/kallithea/bin/kallithea_cli_extensions.py b/kallithea/bin/kallithea_cli_extensions.py --- a/kallithea/bin/kallithea_cli_extensions.py +++ b/kallithea/bin/kallithea_cli_extensions.py @@ -26,7 +26,7 @@ import os import pkg_resources import kallithea -from kallithea.lib.paster_commands.common import ask_ok +from kallithea.lib.utils2 import ask_ok @cli_base.register_command(config_file=True) def extensions_create(): diff --git a/kallithea/bin/kallithea_cli_repo.py b/kallithea/bin/kallithea_cli_repo.py --- a/kallithea/bin/kallithea_cli_repo.py +++ b/kallithea/bin/kallithea_cli_repo.py @@ -27,9 +27,8 @@ import os import re import shutil -from kallithea.lib.paster_commands.common import ask_ok from kallithea.lib.utils import repo2db_mapper, REMOVED_REPO_PAT -from kallithea.lib.utils2 import safe_unicode, safe_str +from kallithea.lib.utils2 import safe_unicode, safe_str, ask_ok from kallithea.model.db import Repository, Ui from kallithea.model.meta import Session from kallithea.model.scm import ScmModel diff --git a/kallithea/lib/db_manage.py b/kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py +++ b/kallithea/lib/db_manage.py @@ -77,7 +77,7 @@ class DbManage(object): force_ask = self.cli_args.get('force_ask') if force_ask is not None: return force_ask - from kallithea.lib.paster_commands.common import ask_ok + from kallithea.lib.utils2 import ask_ok return ask_ok(msg) def init_db(self, SESSION=None): diff --git a/kallithea/lib/paster_commands/common.py b/kallithea/lib/paster_commands/common.py --- a/kallithea/lib/paster_commands/common.py +++ b/kallithea/lib/paster_commands/common.py @@ -38,19 +38,6 @@ import kallithea.lib.utils2 import kallithea.lib.utils -def ask_ok(prompt, retries=4, complaint='Yes or no please!'): - while True: - ok = raw_input(prompt) - if ok in ('y', 'ye', 'yes'): - return True - if ok in ('n', 'no', 'nop', 'nope'): - return False - retries = retries - 1 - if retries < 0: - raise IOError - print complaint - - class BasePasterCommand(gearbox.command.Command): """ Abstract Base Class for gearbox commands. diff --git a/kallithea/lib/utils2.py b/kallithea/lib/utils2.py --- a/kallithea/lib/utils2.py +++ b/kallithea/lib/utils2.py @@ -681,3 +681,16 @@ def repo_name_slug(value): slug = recursive_replace(slug, '-') slug = collapse(slug, '-') return slug + + +def ask_ok(prompt, retries=4, complaint='Yes or no please!'): + while True: + ok = raw_input(prompt) + if ok in ('y', 'ye', 'yes'): + return True + if ok in ('n', 'no', 'nop', 'nope'): + return False + retries = retries - 1 + if retries < 0: + raise IOError + print complaint