From db59c9d92c87c543eb195abb13e39326cd087668 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 22 Jun 2008 01:39:25 +0200 Subject: [PATCH] Cherokee module for HandlerVirt --- ModuleVirt.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ModuleVirt.py diff --git a/ModuleVirt.py b/ModuleVirt.py new file mode 100644 index 0000000..7ad8c53 --- /dev/null +++ b/ModuleVirt.py @@ -0,0 +1,45 @@ +from Form import * +from Table import * +from Module import * +from validations import * + +NOTE_AUTHENTICATE = 'Use authentication when a request is made.' +NOTE_READ_ONLY = 'Only connect to libvirt using a readonly connection.' +NOTE_SERVICE_TYPE = 'What service type should we browse on the network for.' + +class ModuleVirtBase (Module, FormHelper): + PROPERTIES = [ + 'service_type', + 'authenticate' + 'read_only' + ] + + def __init__ (self, cfg, prefix, name, submit_url): + FormHelper.__init__ (self, name, cfg) + Module.__init__ (self, name, cfg, prefix, submit_url) + + def _op_render (self): + txt = "

Libvirt options

" + + table = TableProps() + self.AddPropEntry (table, "mDNS Service Type", "%s!service_type" % (self._prefix), NOTE_SERVICE_TYPE) + self.AddPropCheck (table, "Authenticate", "%s!authenticate" % (self._prefix), True, NOTE_AUTHENTICATE) + self.AddPropCheck (table, "Read Only", "%s!read_only" % (self._prefix), True, NOTE_READ_ONLY) + txt += self.Indent(table) + + return txt + + def _op_apply_changes (self, uri, post): + checkboxes = ['authenticate', 'read_only'] + self.ApplyChangesPrefix (self._prefix, checkboxes, post) + + +class ModuleVirt (ModuleVirtBase): + def __init__ (self, cfg, prefix, submit_url): + ModuleVirtBase.__init__ (self, cfg, prefix, 'virt', submit_url) + + def _op_render (self): + return ModuleVirtBase._op_render (self) + + def _op_apply_changes (self, uri, post): + return ModuleVirtBase._op_apply_changes (self, uri, post) -- 2.11.4.GIT