summaryrefslogtreecommitdiffstats
path: root/ipsilon/admin/common.py
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-08-29 17:50:45 -0400
committerPatrick Uiterwijk <puiterwijk@redhat.com>2014-09-24 20:29:35 +0200
commitef4fcd195bbf4d69bac142b7767aff344588842c (patch)
tree026404ff5c3d98387f01b7bda1f2cc175433571c /ipsilon/admin/common.py
parent7483cfa79415a18f73c29cb7a19e3f91e7945334 (diff)
downloadipsilon-ef4fcd195bbf4d69bac142b7767aff344588842c.tar.gz
ipsilon-ef4fcd195bbf4d69bac142b7767aff344588842c.tar.xz
ipsilon-ef4fcd195bbf4d69bac142b7767aff344588842c.zip
Allow plugins to determine config options order
Ordering may also be partial, for any option not specified they will be appended in lexycographic order. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/admin/common.py')
-rwxr-xr-xipsilon/admin/common.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py
index 424103e..d2ef3cf 100755
--- a/ipsilon/admin/common.py
+++ b/ipsilon/admin/common.py
@@ -36,18 +36,33 @@ class AdminPluginPage(Page):
# Get the defaults
self.plugin_config = obj.get_config_desc()
if not self.plugin_config:
- self.plugin_config = []
+ self.plugin_config = dict()
# Now overlay the actual config
for option in self.plugin_config:
self.plugin_config[option][2] = obj.get_config_value(option)
+ self.options_order = []
+ if hasattr(obj, 'conf_opt_order'):
+ self.options_order = obj.conf_opt_order
+
+ # append any undefined options
+ add = []
+ for k in self.plugin_config.keys():
+ if k not in self.options_order:
+ add.append(k)
+ if len(add):
+ add.sort()
+ for k in add:
+ self.options_order.append(k)
+
@admin_protect
def GET(self, *args, **kwargs):
return self._template('admin/plugin_config.html', title=self.title,
name='admin_%s_%s_form' % (self.facility,
self._obj.name),
menu=self.menu, action=self.url,
+ options_order=self.options_order,
options=self.plugin_config)
@admin_protect