Edgewall Software
Modify

Opened 10 years ago

Last modified 4 years ago

#756 new enhancement

trac-admin initenv might prompt for a wiki-default path

Reported by: eblotml@… Owned by: daniel
Priority: normal Milestone: next-major-releases
Component: admin/console Version: devel
Severity: normal Keywords: newhelp
Cc: thijstriemstra
Release Notes:
API Changes:

Description (last modified by thijstriemstra)

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

  • scripts/trac-admin

     
    1 #!/usr/bin/env python
     1#!/usr/bin/python
    22# -*- coding: iso8859-1 -*-
    33__author__ = 'Daniel Lundin <daniel@edgewall.com>, Jonas Borgström <jonas@edgewall.com>'
    44__copyright__ = 'Copyright (c) 2004 Edgewall Software'
     
    427427
    428428    ## Initenv
    429429    _help_initenv = [('initenv', 'Create and initialize a new environment interactively'),
    430                      ('initenv <projectname> <repospath> <templatepath>',
     430                     ('initenv <projectname> <repospath> <templatepath> <wikipath>',
    431431                      'Create and initialize a new environment from arguments')]
    432432
    433433    def do_initdb(self, line):
     
    460460        dt = trac.siteconfig.__default_templates_dir__
    461461        prompt = 'Templates directory [%s]> ' % dt
    462462        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)
    463470        return returnvals
    464471         
    465472    def do_initenv(self, line):
     
    470477        project_name = None
    471478        repository_dir = None
    472479        templates_dir = None
     480        wiki_dir = None
    473481        if len(arg) == 1:
    474482            returnvals = self.get_initenv_args()
    475483            project_name = returnvals[0]
    476484            repository_dir = returnvals[1]
    477485            templates_dir = returnvals[2]
    478         elif len(arg)!= 3:
     486            wiki_dir = returnvals[3]
     487        elif len(arg)!= 4:
    479488            print 'Wrong number of arguments to initenv %d' % len(arg)
    480489            return
    481490        else:
    482491            project_name = arg[0]
    483492            repository_dir = arg[1]
    484493            templates_dir = arg[2]
     494            wiki_dir = arg[3]
    485495        from svn import util, repos, core
    486496        core.apr_initialize()
    487497        pool = core.svn_pool_create(None)
     
    498508           or not os.access(os.path.join(templates_dir, 'ticket.cs'), os.F_OK):
    499509            print templates_dir, "doesn't look like a Trac templates directory"
    500510            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
    501514        try:
    502515            print 'Creating and Initializing Project'
    503516            self.env_create()
     
    516529            # Add a few default wiki pages
    517530            print ' Installing wiki pages'
    518531            cursor = cnx.cursor()
    519             self._do_wiki_load(trac.siteconfig.__default_wiki_dir__,cursor)
     532            self._do_wiki_load(wiki_dir,cursor)
    520533
    521534            print ' Indexing repository'
    522535            sync.sync(cnx, rep, fs_ptr, pool)

Attachments (0)

Change History (9)

comment:1 Changed 10 years ago by vittorio

  • Severity changed from minor to enhancement

comment:2 Changed 9 years ago by clay@…

  • Milestone set to 0.9
  • Priority changed from low to normal

I would love to see this in 0.9 — any chance of that happening?

comment:3 Changed 9 years ago by cmlenz

  • Component changed from general to trac-admin
  • Owner changed from jonas to daniel

comment:4 Changed 9 years ago by cmlenz

  • Milestone changed from 0.9 to 0.9.1

See also #156. We need to adopt getopt or optparse for trac-admin initenv to address this stuff, I think.

comment:5 Changed 9 years ago by cmlenz

  • Milestone changed from 0.9.1 to 0.9.2

comment:6 Changed 9 years ago by cmlenz

  • Milestone changed from 0.9.3 to 1.0

We should be switching to using optparse for initenv, where we could provide an option for overriding the wiki default pages directory.

comment:7 Changed 6 years ago by anonymous

  • Keywords newhelp added

comment:8 Changed 5 years ago by cboos

  • Milestone changed from 1.0 to unscheduled

Milestone 1.0 deleted

comment:9 Changed 4 years ago by thijstriemstra

  • Cc thijstriemstra added
  • Description modified (diff)
  • Milestone changed from unscheduled to next-major-0.1X

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain daniel.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from daniel to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.