Code

better support for demoing mysql/postgresql
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 31 Mar 2004 23:07:51 +0000 (23:07 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 31 Mar 2004 23:07:51 +0000 (23:07 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2237 57a73879-2fb5-44c3-a270-3262357dd7e2

demo.py

diff --git a/demo.py b/demo.py
index a91be9d6bf33d6fc4f8f9e40579c5e256746c703..7d7f9479adb9f05e98adf162ae3334b15a169b6b 100644 (file)
--- a/demo.py
+++ b/demo.py
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net)
 # 
-# $Id: demo.py,v 1.9 2004-03-24 05:39:47 richard Exp $
+# $Id: demo.py,v 1.10 2004-03-31 23:07:51 richard Exp $
 
 import sys, os, string, re, urlparse
 import shutil, socket, errno, BaseHTTPServer
@@ -12,7 +12,24 @@ def install_demo(home, backend):
     # create the instance
     if os.path.exists(home):
         shutil.rmtree(home)
-    from roundup import init, instance, password
+    from roundup import init, instance, password, backends
+
+    # see if we have further db nuking to perform
+    module = getattr(backends, backend)
+    if backend == 'mysql':
+        class config:
+            MYSQL_DBHOST = 'localhost'
+            MYSQL_DBUSER = 'rounduptest'
+            MYSQL_DBPASSWORD = 'rounduptest'
+            MYSQL_DBNAME = 'rounduptest'
+            DATABASE = 'home'
+        module.db_nuke(config)
+    elif backend == 'postgresql':
+        class config:
+            POSTGRESQL_DATABASE = {'database': 'rounduptest'}
+            DATABASE = 'home'
+        module.db_nuke(config, 1)
+
     init.install(home, os.path.join('templates', 'classic'))
     # don't have email flying around
     os.remove(os.path.join(home, 'detectors', 'nosyreaction.py'))