And the files that actually handler the tender phase now.
[handlervirt.git] / ModuleVirt.py
blob670a4131708b1e396960a838cb6c6173e63a62ba
1 from Form import *
2 from Table import *
3 from Module import *
4 from validations import *
6 NOTE_AUTHENTICATE = 'Use authentication when a request is made.'
7 NOTE_READ_ONLY = 'Only connect to libvirt using a readonly connection.'
8 NOTE_SERVICE_TYPE = 'What service type should we browse on the network for.'
9 NOTE_XSL = 'You can make a custom stylesheet for the XML output of libvirt.'
11 class ModuleVirtBase (Module, FormHelper):
12 PROPERTIES = [
13 'service_type',
14 'authenticate',
15 'read_only',
16 'xsl'
19 def __init__ (self, cfg, prefix, name, submit_url):
20 FormHelper.__init__ (self, name, cfg)
21 Module.__init__ (self, name, cfg, prefix, submit_url)
23 def _op_render (self):
24 txt = "<h2>Libvirt options</h2>"
26 table = TableProps()
27 self.AddPropEntry (table, "mDNS Service Type", "%s!service_type" % (self._prefix), NOTE_SERVICE_TYPE)
28 self.AddPropCheck (table, "Authenticate", "%s!authenticate" % (self._prefix), True, NOTE_AUTHENTICATE)
29 self.AddPropCheck (table, "Read Only", "%s!read_only" % (self._prefix), True, NOTE_READ_ONLY)
30 self.AddPropEntry (table, "XSL Stylesheet", "%s!xsl" % (self._prefix), NOTE_XSL)
31 txt += self.Indent(table)
33 return txt
35 def _op_apply_changes (self, uri, post):
36 checkboxes = ['authenticate', 'read_only']
37 self.ApplyChangesPrefix (self._prefix, checkboxes, post)
40 class ModuleVirt (ModuleVirtBase):
41 def __init__ (self, cfg, prefix, submit_url):
42 ModuleVirtBase.__init__ (self, cfg, prefix, 'virt', submit_url)
44 def _op_render (self):
45 return ModuleVirtBase._op_render (self)
47 def _op_apply_changes (self, uri, post):
48 return ModuleVirtBase._op_apply_changes (self, uri, post)