[Osaas-commits] r16 - in trunk: . server server/osaas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 28 16:18:24 CEST 2007


Author: bh
Date: 2007-08-28 16:18:24 +0200 (Tue, 28 Aug 2007)
New Revision: 16

Added:
   trunk/server/initosaasdb.py
   trunk/server/osaas/dbinit.py
Modified:
   trunk/ChangeLog
Log:
* server/osaas/dbinit.py: New. Helper program to initialize the
database according to the settings from the config file.

* server/initosaasdb.py: New. Frontend for osaas.dbinit.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-28 14:16:38 UTC (rev 15)
+++ trunk/ChangeLog	2007-08-28 14:18:24 UTC (rev 16)
@@ -1,5 +1,12 @@
 2007-08-28  Bernhard Herzog  <bh at intevation.de>
 
+	* server/osaas/dbinit.py: New. Helper program to initialize the
+	database according to the settings from the config file.
+
+	* server/initosaasdb.py: New. Frontend for osaas.dbinit.
+
+2007-08-28  Bernhard Herzog  <bh at intevation.de>
+
 	* server/osaas/run.py (OSAASServerProgram.instantiate_server):
 	Instantiate the DBBackend and pass it to the server
 

Added: trunk/server/initosaasdb.py
===================================================================
--- trunk/server/initosaasdb.py	2007-08-28 14:16:38 UTC (rev 15)
+++ trunk/server/initosaasdb.py	2007-08-28 14:18:24 UTC (rev 16)
@@ -0,0 +1,12 @@
+#! /usr/bin/env python
+# Copyright (C) 2007 by Intevation GmbH
+# Authors:
+# Bernhard Herzog <bh at intevation.de>
+#
+# This program is free software under the GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+from osaas.dbinit import main
+
+if __name__ == "__main__":
+    main()


Property changes on: trunk/server/initosaasdb.py
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/server/osaas/dbinit.py
===================================================================
--- trunk/server/osaas/dbinit.py	2007-08-28 14:16:38 UTC (rev 15)
+++ trunk/server/osaas/dbinit.py	2007-08-28 14:18:24 UTC (rev 16)
@@ -0,0 +1,33 @@
+# Copyright (C) 2007 by Intevation GmbH
+# Authors:
+# Bernhard Herzog <bh at intevation.de>
+#
+# This program is free software under the GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+import sys
+import optparse
+
+from http.run import ProgramWithOptions
+from run import OSAASProgramMixin
+from config import OSAASOption, read_config_file
+from dbbackend import DBBackend
+
+class DBInitProgram(OSAASProgramMixin, ProgramWithOptions):
+
+    def create_option_parser(self, **kw):
+        parser = ProgramWithOptions.create_option_parser(self, **kw)
+        self.add_db_options(parser)
+        return parser
+
+    def main(self):
+        opts, rest = self.parse_options(sys.argv[1:])
+
+        backend = DBBackend((opts.db_user, opts.db_password, opts.db_dsn),
+                            opts.db_rules)
+        backend.create_tables()
+
+
+def main():
+    program = DBInitProgram()
+    program.main()


Property changes on: trunk/server/osaas/dbinit.py
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native



More information about the Osaas-commits mailing list