Skip to content

Commit

Permalink
Allow none for single_user_profile_list
Browse files Browse the repository at this point in the history
Signed-off-by: Gaetan Semet <[email protected]>
  • Loading branch information
gsemet committed Mar 7, 2018
1 parent af1dd7b commit 1338224
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kubespawner/profile_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class KubeProfileSpawner(KubeSpawner):

single_user_profile_list = List(
trait = Dict(),
default_value = [],
default_value = None,
minlen = 0,
config = True,
help = """List of profiles to offer for selection. Signature is:
Expand All @@ -51,6 +51,8 @@ class KubeProfileSpawner(KubeSpawner):
# Spawner.__init__(self, *args, **kwargs)

def _options_form_default(self):
if not self.single_user_profile_list:
return
temp_keys = [
{
'display': p.get('display_name', self.UNDEFINED_DISPLAY_NAME),
Expand All @@ -62,6 +64,8 @@ def _options_form_default(self):
return self.form_template.format(input_template=text)

def options_from_form(self, formdata):
if not self.single_user_profile_list:
return form_data
# Default to first profile if somehow none is provided
selected_profile = int(formdata.get('profile',[0])[0])
options = self.single_user_profile_list[selected_profile]
Expand Down

0 comments on commit 1338224

Please sign in to comment.