-# Or path to database file if using sqlite3.
-DATABASE_NAME = options.get('frontend', 'database_name' )
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+if not options.has_section(database_section):
+ raise ConfigParser.NoSectionError(
+ "No database=<database_section_name> defined")
+
+# 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+DATABASE_ENGINE = options.get(database_section, 'engine')
+DATABASE_NAME = options.get(database_section, 'name')
+if options.has_option(database_section, 'user'):
+ DATABASE_USER = options.get(database_section, 'user')
+if options.has_option(database_section, 'host'):
+ DATABASE_HOST = options.get(database_section, 'host')
+if options.has_option(database_section, 'port'):
+ DATABASE_PORT = options.get(database_section, 'port')
+
+if options.has_option(database_section, 'password_file'):
+ password_file = options.get(database_section, 'password_file')
+ DATABASE_PASSWORD = open(password_file,'r').readline()
+elif options.has_option(database_section, 'password'):
+ DATABASE_PASSWORD = options.get(database_section, 'password')