comparison roundup/init.py @ 68:5e71aaa87e5b

Added templatebuilder module. two functions - one to pack up the html base, one to unpack it. Packed up the two standard templates into htmlbases. Modified __init__ to install them. __init__.py magic was needed for the rather high levels of wierd import magic. Reducing level of import magic == (good, future)
author Anthony Baxter <anthonybaxter@users.sourceforge.net>
date Tue, 24 Jul 2001 10:46:22 +0000
parents 3a7e5515c1bd
children 0eed07d99b98
comparison
equal deleted inserted replaced
67:5b0406c37ccd 68:5e71aaa87e5b
1 # $Id: init.py,v 1.3 2001-07-23 08:45:28 richard Exp $ 1 # $Id: init.py,v 1.4 2001-07-24 10:46:22 anthonybaxter Exp $
2 2
3 import os, shutil, sys 3 import os, shutil, sys
4 4
5 def copytree(src, dst, symlinks=0): 5 def copytree(src, dst, symlinks=0):
6 """Recursively copy a directory tree using copy2(). 6 """Recursively copy a directory tree using copy2().
33 33
34 def init(instance, template, backend, adminpw): 34 def init(instance, template, backend, adminpw):
35 ''' initialise an instance using the named template 35 ''' initialise an instance using the named template
36 ''' 36 '''
37 # first, copy the template dir over 37 # first, copy the template dir over
38 import roundup.templatebuilder
39
38 template_dir = os.path.split(__file__)[0] 40 template_dir = os.path.split(__file__)[0]
41 template_name = template
39 template = os.path.join(template_dir, 'templates', template) 42 template = os.path.join(template_dir, 'templates', template)
40 copytree(template, instance) 43 copytree(template, instance)
44
45 roundup.templatebuilder.installHtmlBase(template_name, instance)
41 46
42 # now select database 47 # now select database
43 db = '''# WARNING: DO NOT EDIT THIS FILE!!! 48 db = '''# WARNING: DO NOT EDIT THIS FILE!!!
44 from roundup.backends.back_%s import Database'''%backend 49 from roundup.backends.back_%s import Database'''%backend
45 open(os.path.join(instance, 'select_db.py'), 'w').write(db) 50 open(os.path.join(instance, 'select_db.py'), 'w').write(db)
50 instance = __import__(instance) 55 instance = __import__(instance)
51 instance.init(adminpw) 56 instance.init(adminpw)
52 57
53 # 58 #
54 # $Log: not supported by cvs2svn $ 59 # $Log: not supported by cvs2svn $
60 # Revision 1.3 2001/07/23 08:45:28 richard
61 # ok, so now "./roundup-admin init" will ask questions in an attempt to get a
62 # workable instance_home set up :)
63 # _and_ anydbm has had its first test :)
64 #
55 # Revision 1.2 2001/07/22 12:09:32 richard 65 # Revision 1.2 2001/07/22 12:09:32 richard
56 # Final commit of Grande Splite 66 # Final commit of Grande Splite
57 # 67 #
58 # 68 #

Roundup Issue Tracker: http://roundup-tracker.org/