Mercurial > p > roundup > code
comparison roundup/admin.py @ 2889:accb3b411ef6
instructions and method for generating config.ini
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 09 Nov 2004 23:12:12 +0000 |
| parents | adec352e2ce0 |
| children | 7c438646531a 2ac85e66e9bb |
comparison
equal
deleted
inserted
replaced
| 2887:23ed4195e442 | 2889:accb3b411ef6 |
|---|---|
| 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.84 2004-11-03 01:34:21 richard Exp $ | 19 # $Id: admin.py,v 1.85 2004-11-09 23:12:11 richard 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 |
| 366 ' does not exist')%locals() | 366 ' does not exist')%locals() |
| 367 | 367 |
| 368 config_ini_file = os.path.join(tracker_home, CoreConfig.INI_FILE) | 368 config_ini_file = os.path.join(tracker_home, CoreConfig.INI_FILE) |
| 369 # check for both old- and new-style configs | 369 # check for both old- and new-style configs |
| 370 if filter(os.path.exists, [config_ini_file, | 370 if filter(os.path.exists, [config_ini_file, |
| 371 os.path.join(tracker_home, 'config.py'), | 371 os.path.join(tracker_home, 'config.py')]): |
| 372 ]): | |
| 373 ok = raw_input(_( | 372 ok = raw_input(_( |
| 374 """WARNING: There appears to be a tracker in "%(tracker_home)s"! | 373 """WARNING: There appears to be a tracker in "%(tracker_home)s"! |
| 375 If you re-install it, you will lose all the data! | 374 If you re-install it, you will lose all the data! |
| 376 Erase it? Y/N: """) % locals()) | 375 Erase it? Y/N: """) % locals()) |
| 377 if ok.strip().lower() != 'y': | 376 if ok.strip().lower() != 'y': |
| 431 'database_config_file': os.path.join(tracker_home, 'schema.py'), | 430 'database_config_file': os.path.join(tracker_home, 'schema.py'), |
| 432 'database_init_file': os.path.join(tracker_home, 'initial_data.py'), | 431 'database_init_file': os.path.join(tracker_home, 'initial_data.py'), |
| 433 } | 432 } |
| 434 return 0 | 433 return 0 |
| 435 | 434 |
| 435 def do_genconfig(self, args): | |
| 436 ""'''Usage: genconfig <filename> | |
| 437 Generate a new tracker config file (ini style) with default values | |
| 438 in <filename>. | |
| 439 ''' | |
| 440 if len(args) < 1: | |
| 441 raise UsageError, _('Not enough arguments supplied') | |
| 442 config = CoreConfig() | |
| 443 config.save(args[0]) | |
| 436 | 444 |
| 437 def do_initialise(self, tracker_home, args): | 445 def do_initialise(self, tracker_home, args): |
| 438 ""'''Usage: initialise [adminpw] | 446 ""'''Usage: initialise [adminpw] |
| 439 Initialise a new Roundup tracker. | 447 Initialise a new Roundup tracker. |
| 440 | 448 |
| 1248 if command == 'morehelp': | 1256 if command == 'morehelp': |
| 1249 self.do_help(['help']) | 1257 self.do_help(['help']) |
| 1250 self.help_commands() | 1258 self.help_commands() |
| 1251 self.help_all() | 1259 self.help_all() |
| 1252 return 0 | 1260 return 0 |
| 1261 if command == 'config': | |
| 1262 self.do_config(args[1:]) | |
| 1263 return 0 | |
| 1253 | 1264 |
| 1254 # figure what the command is | 1265 # figure what the command is |
| 1255 try: | 1266 try: |
| 1256 functions = self.commands.get(command) | 1267 functions = self.commands.get(command) |
| 1257 except KeyError: | 1268 except KeyError: |
