Skip to content

Commit 640e7c4

Browse files
author
Alexander Smishlajev
committed
do_install: consider both old- and new-style layouts in reinstall check;
fix install notice; fix vim modeline
1 parent 301f83b commit 640e7c4

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

roundup/admin.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: admin.py,v 1.79 2004-10-08 05:37:44 richard Exp $
19+
# $Id: admin.py,v 1.80 2004-10-16 14:51:08 a1s Exp $
2020

2121
'''Administration commands for maintaining Roundup trackers.
2222
'''
@@ -26,6 +26,7 @@
2626
from roundup import date, hyperdb, roundupdb, init, password, token, rcsv
2727
from roundup import __version__ as roundup_version
2828
import roundup.instance
29+
from roundup.configuration import CoreConfig
2930
from roundup.i18n import _
3031

3132
class CommandDict(UserDict.UserDict):
@@ -364,7 +365,11 @@ def do_install(self, tracker_home, args):
364365
raise UsageError, _('Instance home parent directory "%(parent)s"'
365366
' does not exist')%locals()
366367

367-
if os.path.exists(os.path.join(tracker_home, 'config.py')):
368+
config_ini_file = os.path.join(tracker_home, CoreConfig.INI_FILE)
369+
# check for both old- and new-style configs
370+
if filter(os.path.exists, [config_ini_file,
371+
os.path.join(tracker_home, 'config.py'),
372+
]):
368373
ok = raw_input(_(
369374
"""WARNING: There appears to be a tracker in "%(tracker_home)s"!
370375
If you re-install it, you will lose all the data!
@@ -401,19 +406,30 @@ def do_install(self, tracker_home, args):
401406
init.install(tracker_home, templates[template]['path'])
402407
init.write_select_db(tracker_home, backend)
403408

404-
print _('''
409+
print _("""
405410
You should now edit the tracker configuration file:
406-
%(config_file)s
407-
... at a minimum, you must set MAILHOST, TRACKER_WEB, MAIL_DOMAIN and
408-
ADMIN_EMAIL.
409-
410-
If you wish to modify the default schema, you should also edit
411-
the database initialisation file:
411+
%(config_file)s""") % {"config_file": config_ini_file}
412+
413+
# find list of options that need manual adjustments
414+
# XXX config._get_unset_options() is marked as private
415+
# (leading underscore). make it public or don't care?
416+
need_set = CoreConfig(tracker_home)._get_unset_options()
417+
if need_set:
418+
print _(" ... at a minimum, you must set following options:")
419+
for section, options in need_set.items():
420+
print " [%s]: %s" % (section, ", ".join(options))
421+
422+
# note about schema modifications
423+
print _("""
424+
If you wish to modify the database schema,
425+
you should also edit the schema file:
412426
%(database_config_file)s
427+
You may also change the database initialisation file:
428+
%(database_init_file)s
413429
... see the documentation on customizing for more information.
414-
''')%{
415-
'config_file': os.path.join(tracker_home, 'config.py'),
416-
'database_config_file': os.path.join(tracker_home, 'dbinit.py')
430+
""") % {
431+
'database_config_file': os.path.join(tracker_home, 'schema.py'),
432+
'database_init_file': os.path.join(tracker_home, 'initial_data.py'),
417433
}
418434
return 0
419435

@@ -1388,4 +1404,4 @@ def main(self):
13881404
tool = AdminTool()
13891405
sys.exit(tool.main())
13901406

1391-
# vim: set filetype=python ts=4 sw=4 et si
1407+
# vim: set filetype=python sts=4 sw=4 et si :

0 commit comments

Comments
 (0)