Now also parse new diffs
[handlerosm.git] / ModuleOsm.py
blobc68520da8275097b1c8b0c5c42dfa6fb64a13441
1 from Form import *
2 from Table import *
3 from ModuleHandler import *
4 from validations import *
5 from consts 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.'
15 HELPS = [
16 ('modules_handlers_osm', "OSM")
19 class ModuleOsm (ModuleHandler):
20 PROPERTIES = [
21 'read_only',
22 'db_hostname',
23 'db_port',
24 'db_username',
25 'db_password',
26 'db_name'
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):
34 txt = ''
36 txt += "<h2>Osm options</h2>"
38 table = TableProps()
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)
47 return txt
49 def _op_apply_changes (self, uri, post):
50 checkboxes = ['read_only']
51 self.ApplyChangesPrefix (self._prefix, checkboxes, post)