Mercurial > p > roundup > code
comparison roundup/admin.py @ 2767:f6072f395f87
do_install: consider both old- and new-style layouts in reinstall check;
fix install notice;
fix vim modeline
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Sat, 16 Oct 2004 14:51:08 +0000 |
| parents | 402d6d556558 |
| children | 2a8a4d8ab339 |
comparison
equal
deleted
inserted
replaced
| 2766:b2cd472919c8 | 2767:f6072f395f87 |
|---|---|
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 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 $ |
| 20 | 20 |
| 21 '''Administration commands for maintaining Roundup trackers. | 21 '''Administration commands for maintaining Roundup trackers. |
| 22 ''' | 22 ''' |
| 23 __docformat__ = 'restructuredtext' | 23 __docformat__ = 'restructuredtext' |
| 24 | 24 |
| 25 import sys, os, getpass, getopt, re, UserDict, shutil, rfc822 | 25 import sys, os, getpass, getopt, re, UserDict, shutil, rfc822 |
| 26 from roundup import date, hyperdb, roundupdb, init, password, token, rcsv | 26 from roundup import date, hyperdb, roundupdb, init, password, token, rcsv |
| 27 from roundup import __version__ as roundup_version | 27 from roundup import __version__ as roundup_version |
| 28 import roundup.instance | 28 import roundup.instance |
| 29 from roundup.configuration import CoreConfig | |
| 29 from roundup.i18n import _ | 30 from roundup.i18n import _ |
| 30 | 31 |
| 31 class CommandDict(UserDict.UserDict): | 32 class CommandDict(UserDict.UserDict): |
| 32 '''Simple dictionary that lets us do lookups using partial keys. | 33 '''Simple dictionary that lets us do lookups using partial keys. |
| 33 | 34 |
| 362 parent = os.path.split(tracker_home)[0] | 363 parent = os.path.split(tracker_home)[0] |
| 363 if not os.path.exists(parent): | 364 if not os.path.exists(parent): |
| 364 raise UsageError, _('Instance home parent directory "%(parent)s"' | 365 raise UsageError, _('Instance home parent directory "%(parent)s"' |
| 365 ' does not exist')%locals() | 366 ' does not exist')%locals() |
| 366 | 367 |
| 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 ]): | |
| 368 ok = raw_input(_( | 373 ok = raw_input(_( |
| 369 """WARNING: There appears to be a tracker in "%(tracker_home)s"! | 374 """WARNING: There appears to be a tracker in "%(tracker_home)s"! |
| 370 If you re-install it, you will lose all the data! | 375 If you re-install it, you will lose all the data! |
| 371 Erase it? Y/N: """) % locals()) | 376 Erase it? Y/N: """) % locals()) |
| 372 if ok.strip().lower() != 'y': | 377 if ok.strip().lower() != 'y': |
| 399 | 404 |
| 400 # install! | 405 # install! |
| 401 init.install(tracker_home, templates[template]['path']) | 406 init.install(tracker_home, templates[template]['path']) |
| 402 init.write_select_db(tracker_home, backend) | 407 init.write_select_db(tracker_home, backend) |
| 403 | 408 |
| 404 print _(''' | 409 print _(""" |
| 405 You should now edit the tracker configuration file: | 410 You should now edit the tracker configuration file: |
| 406 %(config_file)s | 411 %(config_file)s""") % {"config_file": config_ini_file} |
| 407 ... at a minimum, you must set MAILHOST, TRACKER_WEB, MAIL_DOMAIN and | 412 |
| 408 ADMIN_EMAIL. | 413 # find list of options that need manual adjustments |
| 409 | 414 # XXX config._get_unset_options() is marked as private |
| 410 If you wish to modify the default schema, you should also edit | 415 # (leading underscore). make it public or don't care? |
| 411 the database initialisation file: | 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: | |
| 412 %(database_config_file)s | 426 %(database_config_file)s |
| 427 You may also change the database initialisation file: | |
| 428 %(database_init_file)s | |
| 413 ... see the documentation on customizing for more information. | 429 ... see the documentation on customizing for more information. |
| 414 ''')%{ | 430 """) % { |
| 415 'config_file': os.path.join(tracker_home, 'config.py'), | 431 'database_config_file': os.path.join(tracker_home, 'schema.py'), |
| 416 'database_config_file': os.path.join(tracker_home, 'dbinit.py') | 432 'database_init_file': os.path.join(tracker_home, 'initial_data.py'), |
| 417 } | 433 } |
| 418 return 0 | 434 return 0 |
| 419 | 435 |
| 420 | 436 |
| 421 def do_initialise(self, tracker_home, args): | 437 def do_initialise(self, tracker_home, args): |
| 1386 | 1402 |
| 1387 if __name__ == '__main__': | 1403 if __name__ == '__main__': |
| 1388 tool = AdminTool() | 1404 tool = AdminTool() |
| 1389 sys.exit(tool.main()) | 1405 sys.exit(tool.main()) |
| 1390 | 1406 |
| 1391 # vim: set filetype=python ts=4 sw=4 et si | 1407 # vim: set filetype=python sts=4 sw=4 et si : |
