Mercurial > p > roundup > code
comparison demo.py @ 2167:4dafc87a0113
better support for demoing mysql/postgresql
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 31 Mar 2004 23:07:51 +0000 |
| parents | f376437cd35c |
| children | 31cb1014300c b654a33346a6 |
comparison
equal
deleted
inserted
replaced
| 2166:cd42c3c7173a | 2167:4dafc87a0113 |
|---|---|
| 1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net) | 3 # Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net) |
| 4 # | 4 # |
| 5 # $Id: demo.py,v 1.9 2004-03-24 05:39:47 richard Exp $ | 5 # $Id: demo.py,v 1.10 2004-03-31 23:07:51 richard Exp $ |
| 6 | 6 |
| 7 import sys, os, string, re, urlparse | 7 import sys, os, string, re, urlparse |
| 8 import shutil, socket, errno, BaseHTTPServer | 8 import shutil, socket, errno, BaseHTTPServer |
| 9 from glob import glob | 9 from glob import glob |
| 10 | 10 |
| 11 def install_demo(home, backend): | 11 def install_demo(home, backend): |
| 12 # create the instance | 12 # create the instance |
| 13 if os.path.exists(home): | 13 if os.path.exists(home): |
| 14 shutil.rmtree(home) | 14 shutil.rmtree(home) |
| 15 from roundup import init, instance, password | 15 from roundup import init, instance, password, backends |
| 16 | |
| 17 # see if we have further db nuking to perform | |
| 18 module = getattr(backends, backend) | |
| 19 if backend == 'mysql': | |
| 20 class config: | |
| 21 MYSQL_DBHOST = 'localhost' | |
| 22 MYSQL_DBUSER = 'rounduptest' | |
| 23 MYSQL_DBPASSWORD = 'rounduptest' | |
| 24 MYSQL_DBNAME = 'rounduptest' | |
| 25 DATABASE = 'home' | |
| 26 module.db_nuke(config) | |
| 27 elif backend == 'postgresql': | |
| 28 class config: | |
| 29 POSTGRESQL_DATABASE = {'database': 'rounduptest'} | |
| 30 DATABASE = 'home' | |
| 31 module.db_nuke(config, 1) | |
| 32 | |
| 16 init.install(home, os.path.join('templates', 'classic')) | 33 init.install(home, os.path.join('templates', 'classic')) |
| 17 # don't have email flying around | 34 # don't have email flying around |
| 18 os.remove(os.path.join(home, 'detectors', 'nosyreaction.py')) | 35 os.remove(os.path.join(home, 'detectors', 'nosyreaction.py')) |
| 19 try: | 36 try: |
| 20 os.remove(os.path.join(home, 'detectors', 'nosyreaction.pyc')) | 37 os.remove(os.path.join(home, 'detectors', 'nosyreaction.pyc')) |
