Mailing List Archive

Wiki-default specifier
I'm not sure if it could help someone, but installing different Trac environments on my server
is tricky, as trac-admin read the system-wide default config, and does not prompt for the
default wiki page.

Here is a tiny patch to specify the default wiki-default directory when initializing a new
environment from trac-admin. Wiki-default directory is either specified on the 'initenv' command
line, or prompted during the interactive init session, as it is already done for the Clearsilver
templares dir.

HTH,
Manu.


Index: trac-admin
===================================================================
--- trac-admin (revision 915)
+++ trac-admin (working copy)
@@ -427,7 +427,7 @@

## Initenv
_help_initenv = [.('initenv', 'Create and initialize a new environment interactively'),
- ('initenv <projectname> <repospath> <templatepath>',
+ ('initenv <projectname> <repospath> <templatepath> <wikipath>',
'Create and initialize a new environment from arguments')]

def do_initdb(self, line):
@@ -460,6 +460,13 @@
dt = trac.siteconfig.__default_templates_dir__
prompt = 'Templates directory [%s]> ' % dt
returnvals.append(raw_input(prompt) or dt)
+ print
+ print ' Please enter location of Trac initial wiki pages.'
+ print ' Default is the location of the site-wide wiki pages installed with Trac.'
+ print
+ dw = trac.siteconfig.__default_wiki_dir__
+ prompt = 'Wiki pages directory [%s]> ' % dw
+ returnvals.append(raw_input(prompt) or dw)
return returnvals

def do_initenv(self, line):
@@ -470,18 +477,21 @@
project_name = None
repository_dir = None
templates_dir = None
+ wiki_dir = None
if len(arg) == 1:
returnvals = self.get_initenv_args()
project_name = returnvals[0]
repository_dir = returnvals[1]
templates_dir = returnvals[2]
- elif len(arg)!= 3:
+ wiki_dir = returnvals[3]
+ elif len(arg)!= 4:
print 'Wrong number of arguments to initenv %d' % len(arg)
return
else:
project_name = arg[0]
repository_dir = arg[1]
templates_dir = arg[2]
+ wiki_dir = arg[3]
from svn import util, repos, core
core.apr_initialize()
pool = core.svn_pool_create(None)
@@ -498,6 +508,9 @@
or not os.access(os.path.join(templates_dir, 'ticket.cs'), os.F_OK):
print templates_dir, "doesn't look like a Trac templates directory"
return
+ if not os.access(os.path.join(wiki_dir, 'WikiStart'), os.F_OK):
+ print wiki_dir, "doesn't seem to contain initial Wiki pages"
+ return
try:
print 'Creating and Initializing Project'
self.env_create()
@@ -516,7 +529,7 @@
# Add a few default wiki pages
print ' Installing wiki pages'
cursor = cnx.cursor()
- self._do_wiki_load(trac.siteconfig.__default_wiki_dir__,cursor)
+ self._do_wiki_load(wiki_dir,cursor)

print ' Indexing repository'
sync.sync(cnx, rep, fs_ptr, pool)