4 from validations
import *
6 NOTE_READ_ONLY
= 'Never write to the database.'
7 NOTE_DB_HOSTNAME
= 'The hostname of your database server.'
8 NOTE_DB_PORT
= 'The port your database server listens on.'
9 NOTE_DB_USERNAME
= 'The username you want to connect to your database.'
10 NOTE_DB_PASSWORD
= 'The password to connect to your database (warning security risk).'
11 NOTE_DB_NAME
= 'The database you want to connect to.'
13 class ModuleOsmBase (Module
, FormHelper
):
23 def __init__ (self
, cfg
, prefix
, name
, submit_url
):
24 FormHelper
.__init
__ (self
, name
, cfg
)
25 Module
.__init
__ (self
, name
, cfg
, prefix
, submit_url
)
27 def _op_render (self
):
28 txt
= "<h2>Osm options</h2>"
31 self
.AddPropEntry (table
, "DB Hostname", "%s!db_hostname" % (self
._prefix
), NOTE_DB_HOSTNAME
)
32 self
.AddPropEntry (table
, "DB Port", "%s!db_port" % (self
._prefix
), NOTE_DB_PORT
)
33 self
.AddPropEntry (table
, "DB Username", "%s!db_username" % (self
._prefix
), NOTE_DB_USERNAME
)
34 self
.AddPropEntry (table
, "DB Password", "%s!db_password" % (self
._prefix
), NOTE_DB_PASSWORD
)
35 self
.AddPropEntry (table
, "DB Name", "%s!db_name" % (self
._prefix
), NOTE_DB_NAME
)
36 self
.AddPropCheck (table
, "Read Only", "%s!read_only" % (self
._prefix
), True, NOTE_READ_ONLY
)
37 txt
+= self
.Indent(table
)
41 def _op_apply_changes (self
, uri
, post
):
42 checkboxes
= ['read_only']
43 self
.ApplyChangesPrefix (self
._prefix
, checkboxes
, post
)
45 class ModuleOsm (ModuleOsmBase
):
46 def __init__ (self
, cfg
, prefix
, submit_url
):
47 ModuleOsmBase
.__init
__ (self
, cfg
, prefix
, 'osm', submit_url
)
49 def _op_render (self
):
50 return ModuleOsmBase
._op
_render
(self
)
52 def _op_apply_changes (self
, uri
, post
):
53 return ModuleOsmBase
._op
_apply
_changes
(self
, uri
, post
)