trac-admin initenv might prompt for a wiki-default path
— at Version 9
Trac-admin prompts for default template path, but not for default wiki page path.
The following patch supports wiki-default path on command line and prompts for such a path when initenv
command is invoked.
Proposed patch
-
|
|
|
1 | | #!/usr/bin/env python |
| 1 | #!/usr/bin/python |
2 | 2 | # -*- coding: iso8859-1 -*- |
3 | 3 | __author__ = 'Daniel Lundin <daniel@edgewall.com>, Jonas Borgström <jonas@edgewall.com>' |
4 | 4 | __copyright__ = 'Copyright (c) 2004 Edgewall Software' |
… |
… |
|
427 | 427 | |
428 | 428 | ## Initenv |
429 | 429 | _help_initenv = [('initenv', 'Create and initialize a new environment interactively'), |
430 | | ('initenv <projectname> <repospath> <templatepath>', |
| 430 | ('initenv <projectname> <repospath> <templatepath> <wikipath>', |
431 | 431 | 'Create and initialize a new environment from arguments')] |
432 | 432 | |
433 | 433 | def do_initdb(self, line): |
… |
… |
|
460 | 460 | dt = trac.siteconfig.__default_templates_dir__ |
461 | 461 | prompt = 'Templates directory [%s]> ' % dt |
462 | 462 | returnvals.append(raw_input(prompt) or dt) |
| 463 | print |
| 464 | print ' Please enter location of Trac initial wiki pages.' |
| 465 | print ' Default is the location of the site-wide wiki pages installed with Trac.' |
| 466 | print |
| 467 | dw = trac.siteconfig.__default_wiki_dir__ |
| 468 | prompt = 'Wiki pages directory [%s]> ' % dw |
| 469 | returnvals.append(raw_input(prompt) or dw) |
463 | 470 | return returnvals |
464 | 471 | |
465 | 472 | def do_initenv(self, line): |
… |
… |
|
470 | 477 | project_name = None |
471 | 478 | repository_dir = None |
472 | 479 | templates_dir = None |
| 480 | wiki_dir = None |
473 | 481 | if len(arg) == 1: |
474 | 482 | returnvals = self.get_initenv_args() |
475 | 483 | project_name = returnvals[0] |
476 | 484 | repository_dir = returnvals[1] |
477 | 485 | templates_dir = returnvals[2] |
478 | | elif len(arg)!= 3: |
| 486 | wiki_dir = returnvals[3] |
| 487 | elif len(arg)!= 4: |
479 | 488 | print 'Wrong number of arguments to initenv %d' % len(arg) |
480 | 489 | return |
481 | 490 | else: |
482 | 491 | project_name = arg[0] |
483 | 492 | repository_dir = arg[1] |
484 | 493 | templates_dir = arg[2] |
| 494 | wiki_dir = arg[3] |
485 | 495 | from svn import util, repos, core |
486 | 496 | core.apr_initialize() |
487 | 497 | pool = core.svn_pool_create(None) |
… |
… |
|
498 | 508 | or not os.access(os.path.join(templates_dir, 'ticket.cs'), os.F_OK): |
499 | 509 | print templates_dir, "doesn't look like a Trac templates directory" |
500 | 510 | return |
| 511 | if not os.access(os.path.join(wiki_dir, 'WikiStart'), os.F_OK): |
| 512 | print wiki_dir, "doesn't seem to contain initial Wiki pages" |
| 513 | return |
501 | 514 | try: |
502 | 515 | print 'Creating and Initializing Project' |
503 | 516 | self.env_create() |
… |
… |
|
516 | 529 | # Add a few default wiki pages |
517 | 530 | print ' Installing wiki pages' |
518 | 531 | cursor = cnx.cursor() |
519 | | self._do_wiki_load(trac.siteconfig.__default_wiki_dir__,cursor) |
| 532 | self._do_wiki_load(wiki_dir,cursor) |
520 | 533 | |
521 | 534 | print ' Indexing repository' |
522 | 535 | sync.sync(cnx, rep, fs_ptr, pool) |
Change History
(9)
Severity: |
minor → enhancement
|
Milestone: |
→ 0.9
|
Priority: |
low → normal
|
Component: |
general → trac-admin
|
Owner: |
changed from Jonas Borgström to daniel
|
Milestone: |
1.0 → unscheduled
|
Cc: |
Thijs Triemstra added
|
Description: |
modified (diff)
|
Milestone: |
unscheduled → next-major-0.1X
|
I would love to see this in 0.9 — any chance of that happening?