3 from ModuleHandler
import *
4 from validations
import *
8 NOTE_READ_ONLY
= 'Never write to the database.'
9 NOTE_DB_HOSTNAME
= 'The hostname of your database server.'
10 NOTE_DB_PORT
= 'The port your database server listens on.'
11 NOTE_DB_USERNAME
= 'The username you want to connect to your database.'
12 NOTE_DB_PASSWORD
= 'The password to connect to your database (warning security risk).'
13 NOTE_DB_NAME
= 'The database you want to connect to.'
16 ('modules_handlers_osm', "OSM")
19 class ModuleOsm (ModuleHandler
):
29 def __init__ (self
, cfg
, prefix
, submit
):
30 ModuleHandler
.__init
__ (self
, 'osm', cfg
, prefix
, submit
)
31 self
.show_document_root
= False
33 def _op_render (self
):
36 txt
+= "<h2>Osm options</h2>"
39 self
.AddPropEntry (table
, "DB Hostname", "%s!db_hostname" % (self
._prefix
), NOTE_DB_HOSTNAME
)
40 self
.AddPropEntry (table
, "DB Port", "%s!db_port" % (self
._prefix
), NOTE_DB_PORT
)
41 self
.AddPropEntry (table
, "DB Username", "%s!db_username" % (self
._prefix
), NOTE_DB_USERNAME
)
42 self
.AddPropEntry (table
, "DB Password", "%s!db_password" % (self
._prefix
), NOTE_DB_PASSWORD
)
43 self
.AddPropEntry (table
, "DB Name", "%s!db_name" % (self
._prefix
), NOTE_DB_NAME
)
44 self
.AddPropCheck (table
, "Read Only", "%s!read_only" % (self
._prefix
), True, NOTE_READ_ONLY
)
45 txt
+= self
.Indent(table
)
49 def _op_apply_changes (self
, uri
, post
):
50 checkboxes
= ['read_only']
51 self
.ApplyChangesPrefix (self
._prefix
, checkboxes
, post
)