comparison roundup/admin.py @ 4073:145b32238093

Revert docstring markup for use with gettext tool.
author Stefan Seefeld <stefan@seefeld.name>
date Mon, 23 Feb 2009 20:12:23 +0000
parents 7309ac3b6e24
children eddb82d0964c
comparison
equal deleted inserted replaced
4072:d5e2767d4e91 4073:145b32238093
238 print _('%s:')%name 238 print _('%s:')%name
239 print ' ', _(command.__doc__) 239 print ' ', _(command.__doc__)
240 240
241 def do_help(self, args, nl_re=re.compile('[\r\n]'), 241 def do_help(self, args, nl_re=re.compile('[\r\n]'),
242 indent_re=re.compile(r'^(\s+)\S+')): 242 indent_re=re.compile(r'^(\s+)\S+')):
243 """Usage: help topic 243 ''"""Usage: help topic
244 Give help about topic. 244 Give help about topic.
245 245
246 commands -- list commands 246 commands -- list commands
247 <command> -- help specific to a command 247 <command> -- help specific to a command
248 initopts -- init command options 248 initopts -- init command options
344 import roundup.backends 344 import roundup.backends
345 backends = roundup.backends.list_backends() 345 backends = roundup.backends.list_backends()
346 print _('Back ends:'), ', '.join(backends) 346 print _('Back ends:'), ', '.join(backends)
347 347
348 def do_install(self, tracker_home, args): 348 def do_install(self, tracker_home, args):
349 """Usage: install [template [backend [key=val[,key=val]]]] 349 ''"""Usage: install [template [backend [key=val[,key=val]]]]
350 Install a new Roundup tracker. 350 Install a new Roundup tracker.
351 351
352 The command will prompt for the tracker home directory 352 The command will prompt for the tracker home directory
353 (if not supplied through TRACKER_HOME or the -i option). 353 (if not supplied through TRACKER_HOME or the -i option).
354 The template and backend may be specified on the command-line 354 The template and backend may be specified on the command-line
459 'database_init_file': os.path.join(tracker_home, 'initial_data.py'), 459 'database_init_file': os.path.join(tracker_home, 'initial_data.py'),
460 } 460 }
461 return 0 461 return 0
462 462
463 def do_genconfig(self, args): 463 def do_genconfig(self, args):
464 """Usage: genconfig <filename> 464 ''"""Usage: genconfig <filename>
465 Generate a new tracker config file (ini style) with default values 465 Generate a new tracker config file (ini style) with default values
466 in <filename>. 466 in <filename>.
467 """ 467 """
468 if len(args) < 1: 468 if len(args) < 1:
469 raise UsageError, _('Not enough arguments supplied') 469 raise UsageError, _('Not enough arguments supplied')
470 config = CoreConfig() 470 config = CoreConfig()
471 config.save(args[0]) 471 config.save(args[0])
472 472
473 def do_initialise(self, tracker_home, args): 473 def do_initialise(self, tracker_home, args):
474 """Usage: initialise [adminpw] 474 ''"""Usage: initialise [adminpw]
475 Initialise a new Roundup tracker. 475 Initialise a new Roundup tracker.
476 476
477 The administrator details will be set at this step. 477 The administrator details will be set at this step.
478 478
479 Execute the tracker's initialisation function dbinit.init() 479 Execute the tracker's initialisation function dbinit.init()
518 518
519 return 0 519 return 0
520 520
521 521
522 def do_get(self, args): 522 def do_get(self, args):
523 """Usage: get property designator[,designator]* 523 ''"""Usage: get property designator[,designator]*
524 Get the given property of one or more designator(s). 524 Get the given property of one or more designator(s).
525 525
526 Retrieves the property value of the nodes specified 526 Retrieves the property value of the nodes specified
527 by the designators. 527 by the designators.
528 """ 528 """
592 592
593 return 0 593 return 0
594 594
595 595
596 def do_set(self, args): 596 def do_set(self, args):
597 """Usage: set items property=value property=value ... 597 ''"""Usage: set items property=value property=value ...
598 Set the given properties of one or more items(s). 598 Set the given properties of one or more items(s).
599 599
600 The items are specified as a class or as a comma-separated 600 The items are specified as a class or as a comma-separated
601 list of item designators (ie "designator[,designator,...]"). 601 list of item designators (ie "designator[,designator,...]").
602 602
647 raise UsageError, message 647 raise UsageError, message
648 self.db_uncommitted = True 648 self.db_uncommitted = True
649 return 0 649 return 0
650 650
651 def do_find(self, args): 651 def do_find(self, args):
652 """Usage: find classname propname=value ... 652 ''"""Usage: find classname propname=value ...
653 Find the nodes of the given class with a given link property value. 653 Find the nodes of the given class with a given link property value.
654 654
655 Find the nodes of the given class with a given link property value. 655 Find the nodes of the given class with a given link property value.
656 The value may be either the nodeid of the linked node, or its key 656 The value may be either the nodeid of the linked node, or its key
657 value. 657 value.
707 except (ValueError, TypeError), message: 707 except (ValueError, TypeError), message:
708 raise UsageError, message 708 raise UsageError, message
709 return 0 709 return 0
710 710
711 def do_specification(self, args): 711 def do_specification(self, args):
712 """Usage: specification classname 712 ''"""Usage: specification classname
713 Show the properties for a classname. 713 Show the properties for a classname.
714 714
715 This lists the properties for a given class. 715 This lists the properties for a given class.
716 """ 716 """
717 if len(args) < 1: 717 if len(args) < 1:
754 for key in keys: 754 for key in keys:
755 value = cl.get(nodeid, key) 755 value = cl.get(nodeid, key)
756 print _('%(key)s: %(value)s')%locals() 756 print _('%(key)s: %(value)s')%locals()
757 757
758 def do_create(self, args): 758 def do_create(self, args):
759 """Usage: create classname property=value ... 759 ''"""Usage: create classname property=value ...
760 Create a new entry of a given class. 760 Create a new entry of a given class.
761 761
762 This creates a new entry of the given class using the property 762 This creates a new entry of the given class using the property
763 name=value arguments provided on the command line after the "create" 763 name=value arguments provided on the command line after the "create"
764 command. 764 command.
819 raise UsageError, message 819 raise UsageError, message
820 self.db_uncommitted = True 820 self.db_uncommitted = True
821 return 0 821 return 0
822 822
823 def do_list(self, args): 823 def do_list(self, args):
824 """Usage: list classname [property] 824 ''"""Usage: list classname [property]
825 List the instances of a class. 825 List the instances of a class.
826 826
827 Lists all instances of the given class. If the property is not 827 Lists all instances of the given class. If the property is not
828 specified, the "label" property is used. The label property is 828 specified, the "label" property is used. The label property is
829 tried in order: the key, "name", "title" and then the first 829 tried in order: the key, "name", "title" and then the first
836 if len(args) > 2: 836 if len(args) > 2:
837 raise UsageError, _('Too many arguments supplied') 837 raise UsageError, _('Too many arguments supplied')
838 if len(args) < 1: 838 if len(args) < 1:
839 raise UsageError, _('Not enough arguments supplied') 839 raise UsageError, _('Not enough arguments supplied')
840 classname = args[0] 840 classname = args[0]
841 841
842 # get the class 842 # get the class
843 cl = self.get_class(classname) 843 cl = self.get_class(classname)
844 844
845 # figure the property 845 # figure the property
846 if len(args) > 1: 846 if len(args) > 1:
848 else: 848 else:
849 propname = cl.labelprop() 849 propname = cl.labelprop()
850 850
851 if self.separator: 851 if self.separator:
852 if len(args) == 2: 852 if len(args) == 2:
853 # create a list of propnames since user specified propname 853 # create a list of propnames since user specified propname
854 proplist=[] 854 proplist=[]
855 for nodeid in cl.list(): 855 for nodeid in cl.list():
856 try: 856 try:
857 proplist.append(cl.get(nodeid, propname)) 857 proplist.append(cl.get(nodeid, propname))
858 except KeyError: 858 except KeyError:
872 '"%(propname)s"')%locals() 872 '"%(propname)s"')%locals()
873 print _('%(nodeid)4s: %(value)s')%locals() 873 print _('%(nodeid)4s: %(value)s')%locals()
874 return 0 874 return 0
875 875
876 def do_table(self, args): 876 def do_table(self, args):
877 """Usage: table classname [property[,property]*] 877 ''"""Usage: table classname [property[,property]*]
878 List the instances of a class in tabular form. 878 List the instances of a class in tabular form.
879 879
880 Lists all instances of the given class. If the properties are not 880 Lists all instances of the given class. If the properties are not
881 specified, all properties are displayed. By default, the column 881 specified, all properties are displayed. By default, the column
882 widths are the width of the largest value. The width may be 882 widths are the width of the largest value. The width may be
966 l.append(f%value[:width]) 966 l.append(f%value[:width])
967 print ' '.join(l) 967 print ' '.join(l)
968 return 0 968 return 0
969 969
970 def do_history(self, args): 970 def do_history(self, args):
971 """Usage: history designator 971 ''"""Usage: history designator
972 Show the history entries of a designator. 972 Show the history entries of a designator.
973 973
974 Lists the journal entries for the node identified by the designator. 974 Lists the journal entries for the node identified by the designator.
975 """ 975 """
976 if len(args) < 1: 976 if len(args) < 1:
987 except IndexError: 987 except IndexError:
988 raise UsageError, _('no such %(classname)s node "%(nodeid)s"')%locals() 988 raise UsageError, _('no such %(classname)s node "%(nodeid)s"')%locals()
989 return 0 989 return 0
990 990
991 def do_commit(self, args): 991 def do_commit(self, args):
992 """Usage: commit 992 ''"""Usage: commit
993 Commit changes made to the database during an interactive session. 993 Commit changes made to the database during an interactive session.
994 994
995 The changes made during an interactive session are not 995 The changes made during an interactive session are not
996 automatically written to the database - they must be committed 996 automatically written to the database - they must be committed
997 using this command. 997 using this command.
1002 self.db.commit() 1002 self.db.commit()
1003 self.db_uncommitted = False 1003 self.db_uncommitted = False
1004 return 0 1004 return 0
1005 1005
1006 def do_rollback(self, args): 1006 def do_rollback(self, args):
1007 """Usage: rollback 1007 ''"""Usage: rollback
1008 Undo all changes that are pending commit to the database. 1008 Undo all changes that are pending commit to the database.
1009 1009
1010 The changes made during an interactive session are not 1010 The changes made during an interactive session are not
1011 automatically written to the database - they must be committed 1011 automatically written to the database - they must be committed
1012 manually. This command undoes all those changes, so a commit 1012 manually. This command undoes all those changes, so a commit
1015 self.db.rollback() 1015 self.db.rollback()
1016 self.db_uncommitted = False 1016 self.db_uncommitted = False
1017 return 0 1017 return 0
1018 1018
1019 def do_retire(self, args): 1019 def do_retire(self, args):
1020 """Usage: retire designator[,designator]* 1020 ''"""Usage: retire designator[,designator]*
1021 Retire the node specified by designator. 1021 Retire the node specified by designator.
1022 1022
1023 This action indicates that a particular node is not to be retrieved 1023 This action indicates that a particular node is not to be retrieved
1024 by the list or find commands, and its key value may be re-used. 1024 by the list or find commands, and its key value may be re-used.
1025 """ 1025 """
1039 raise UsageError, _('no such %(classname)s node "%(nodeid)s"')%locals() 1039 raise UsageError, _('no such %(classname)s node "%(nodeid)s"')%locals()
1040 self.db_uncommitted = True 1040 self.db_uncommitted = True
1041 return 0 1041 return 0
1042 1042
1043 def do_restore(self, args): 1043 def do_restore(self, args):
1044 """Usage: restore designator[,designator]* 1044 ''"""Usage: restore designator[,designator]*
1045 Restore the retired node specified by designator. 1045 Restore the retired node specified by designator.
1046 1046
1047 The given nodes will become available for users again. 1047 The given nodes will become available for users again.
1048 """ 1048 """
1049 if len(args) < 1: 1049 if len(args) < 1:
1062 raise UsageError, _('no such %(classname)s node "%(nodeid)s"')%locals() 1062 raise UsageError, _('no such %(classname)s node "%(nodeid)s"')%locals()
1063 self.db_uncommitted = True 1063 self.db_uncommitted = True
1064 return 0 1064 return 0
1065 1065
1066 def do_export(self, args, export_files=True): 1066 def do_export(self, args, export_files=True):
1067 """Usage: export [[-]class[,class]] export_dir 1067 ''"""Usage: export [[-]class[,class]] export_dir
1068 Export the database to colon-separated-value files. 1068 Export the database to colon-separated-value files.
1069 To exclude the files (e.g. for the msg or file class), 1069 To exclude the files (e.g. for the msg or file class),
1070 use the exporttables command. 1070 use the exporttables command.
1071 1071
1072 Optionally limit the export to just the named classes 1072 Optionally limit the export to just the named classes
1137 map(journals.writerow, cl.export_journals()) 1137 map(journals.writerow, cl.export_journals())
1138 jf.close() 1138 jf.close()
1139 return 0 1139 return 0
1140 1140
1141 def do_exporttables(self, args): 1141 def do_exporttables(self, args):
1142 """Usage: exporttables [[-]class[,class]] export_dir 1142 ''"""Usage: exporttables [[-]class[,class]] export_dir
1143 Export the database to colon-separated-value files, excluding the 1143 Export the database to colon-separated-value files, excluding the
1144 files below $TRACKER_HOME/db/files/ (which can be archived separately). 1144 files below $TRACKER_HOME/db/files/ (which can be archived separately).
1145 To include the files, use the export command. 1145 To include the files, use the export command.
1146 1146
1147 Optionally limit the export to just the named classes 1147 Optionally limit the export to just the named classes
1152 destination directory. 1152 destination directory.
1153 """ 1153 """
1154 return self.do_export(args, export_files=False) 1154 return self.do_export(args, export_files=False)
1155 1155
1156 def do_import(self, args): 1156 def do_import(self, args):
1157 """Usage: import import_dir 1157 ''"""Usage: import import_dir
1158 Import a database from the directory containing CSV files, 1158 Import a database from the directory containing CSV files,
1159 two per class to import. 1159 two per class to import.
1160 1160
1161 The files used in the import are: 1161 The files used in the import are:
1162 1162
1227 1227
1228 self.db_uncommitted = True 1228 self.db_uncommitted = True
1229 return 0 1229 return 0
1230 1230
1231 def do_pack(self, args): 1231 def do_pack(self, args):
1232 """Usage: pack period | date 1232 ''"""Usage: pack period | date
1233 1233
1234 Remove journal entries older than a period of time specified or 1234 Remove journal entries older than a period of time specified or
1235 before a certain date. 1235 before a certain date.
1236 1236
1237 A period is specified using the suffixes "y", "m", and "d". The 1237 A period is specified using the suffixes "y", "m", and "d". The
1266 self.db.pack(pack_before) 1266 self.db.pack(pack_before)
1267 self.db_uncommitted = True 1267 self.db_uncommitted = True
1268 return 0 1268 return 0
1269 1269
1270 def do_reindex(self, args, desre=re.compile('([A-Za-z]+)([0-9]+)')): 1270 def do_reindex(self, args, desre=re.compile('([A-Za-z]+)([0-9]+)')):
1271 """Usage: reindex [classname|designator]* 1271 ''"""Usage: reindex [classname|designator]*
1272 Re-generate a tracker's search indexes. 1272 Re-generate a tracker's search indexes.
1273 1273
1274 This will re-generate the search indexes for a tracker. 1274 This will re-generate the search indexes for a tracker.
1275 This will typically happen automatically. 1275 This will typically happen automatically.
1276 """ 1276 """
1290 else: 1290 else:
1291 self.db.reindex(show_progress=True) 1291 self.db.reindex(show_progress=True)
1292 return 0 1292 return 0
1293 1293
1294 def do_security(self, args): 1294 def do_security(self, args):
1295 """Usage: security [Role name] 1295 ''"""Usage: security [Role name]
1296 Display the Permissions available to one or all Roles. 1296 Display the Permissions available to one or all Roles.
1297 """ 1297 """
1298 if len(args) == 1: 1298 if len(args) == 1:
1299 role = args[0] 1299 role = args[0]
1300 try: 1300 try:
1330 print _(' %(description)s (%(name)s)')%d 1330 print _(' %(description)s (%(name)s)')%d
1331 return 0 1331 return 0
1332 1332
1333 1333
1334 def do_migrate(self, args): 1334 def do_migrate(self, args):
1335 """Usage: migrate 1335 ''"""Usage: migrate
1336 Update a tracker's database to be compatible with the Roundup 1336 Update a tracker's database to be compatible with the Roundup
1337 codebase. 1337 codebase.
1338 1338
1339 You should run the "migrate" command for your tracker once you've 1339 You should run the "migrate" command for your tracker once you've
1340 installed the latest codebase. 1340 installed the latest codebase.

Roundup Issue Tracker: http://roundup-tracker.org/