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
):
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>"
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
)
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
)