From 86addb88ce9dca44079577eb348be8127f58b50c Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Wed, 7 Mar 2018 19:47:10 +0100 Subject: [PATCH] Allow none for single_user_profile_list --- kubespawner/profile_spawner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kubespawner/profile_spawner.py b/kubespawner/profile_spawner.py index 2eaa54e37..7a2679a7c 100644 --- a/kubespawner/profile_spawner.py +++ b/kubespawner/profile_spawner.py @@ -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: @@ -51,6 +51,8 @@ class KubeProfileSpawner(KubeSpawner): # Spawner.__init__(self, *args, **kwargs) def _options_form_default(self): + if not self.self.single_user_profile_list: + return temp_keys = [ { 'display': p.get('display_name', self.UNDEFINED_DISPLAY_NAME), @@ -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.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]