Skip to content

Commit f0f7dd4

Browse files
committed
The prompt_choices function now returns a correct result.
The prompt_choices function would try to call string.ascii_lowercase(rv) where rv is a string. This would raise an error because ascii_lowercase is not a function. Assuming that the intended result is a lowercase version of the string, this has been changed to use rv.lower() Also the check:: if isinstance(string, basestring): has been changed to:: if type(string) is str: because basestring is not defined in python3.
1 parent 33e293c commit f0f7dd4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tmuxp/cli.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ def prompt_yes_no(name, default=True):
106106
return prompt_bool(name, default=default)
107107

108108

109-
def prompt_choices(name, choices, default=None, resolve=ascii_lowercase,
110-
no_choice=('none',)):
109+
def prompt_choices(name, choices, default=None, no_choice=('none',)):
111110
"""Return user input from command line from set of provided choices.
112111
113112
:param name: prompt text
@@ -123,7 +122,7 @@ def prompt_choices(name, choices, default=None, resolve=ascii_lowercase,
123122
options = []
124123

125124
for choice in choices:
126-
if isinstance(choice, basestring):
125+
if type(choice) is str:
127126
options.append(choice)
128127
else:
129128
options.append("%s [%s]" % (choice[1], choice[0]))
@@ -134,7 +133,7 @@ def prompt_choices(name, choices, default=None, resolve=ascii_lowercase,
134133
rv = prompt(name + ' - (%s)' % ', '.join(options), default)
135134
if not rv:
136135
return default
137-
rv = resolve(rv)
136+
rv = rv.lower()
138137
if rv in no_choice:
139138
return None
140139
if rv in _choices:

0 commit comments

Comments
 (0)