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.'
10 class ModuleVirtBase (Module
, FormHelper
):
17 def __init__ (self
, cfg
, prefix
, name
, submit_url
):
18 FormHelper
.__init
__ (self
, name
, cfg
)
19 Module
.__init
__ (self
, name
, cfg
, prefix
, submit_url
)
21 def _op_render (self
):
22 txt
= "<h2>Libvirt options</h2>"
25 self
.AddPropEntry (table
, "mDNS Service Type", "%s!service_type" % (self
._prefix
), NOTE_SERVICE_TYPE
)
26 self
.AddPropCheck (table
, "Authenticate", "%s!authenticate" % (self
._prefix
), True, NOTE_AUTHENTICATE
)
27 self
.AddPropCheck (table
, "Read Only", "%s!read_only" % (self
._prefix
), True, NOTE_READ_ONLY
)
28 txt
+= self
.Indent(table
)
32 def _op_apply_changes (self
, uri
, post
):
33 checkboxes
= ['authenticate', 'read_only']
34 self
.ApplyChangesPrefix (self
._prefix
, checkboxes
, post
)
37 class ModuleVirt (ModuleVirtBase
):
38 def __init__ (self
, cfg
, prefix
, submit_url
):
39 ModuleVirtBase
.__init
__ (self
, cfg
, prefix
, 'virt', submit_url
)
41 def _op_render (self
):
42 return ModuleVirtBase
._op
_render
(self
)
44 def _op_apply_changes (self
, uri
, post
):
45 return ModuleVirtBase
._op
_apply
_changes
(self
, uri
, post
)