comparison roundup-admin @ 474:ef06a66a0b72

[SF#496360] table width does not work
author Richard Jones <richard@users.sourceforge.net>
date Mon, 31 Dec 2001 05:20:34 +0000
parents e18210e77a39
children b35f229dd049
comparison
equal deleted inserted replaced
473:99794da60082 474:ef06a66a0b72
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: roundup-admin,v 1.58 2001-12-31 05:12:52 richard Exp $ 19 # $Id: roundup-admin,v 1.59 2001-12-31 05:20:34 richard Exp $
20 20
21 # python version check 21 # python version check
22 from roundup import version_check 22 from roundup import version_check
23 23
24 import sys, os, getpass, getopt, re, UserDict, shlex 24 import sys, os, getpass, getopt, re, UserDict, shlex
634 634
635 # figure the property names to display 635 # figure the property names to display
636 if len(args) > 1: 636 if len(args) > 1:
637 prop_names = args[1].split(',') 637 prop_names = args[1].split(',')
638 all_props = cl.getprops() 638 all_props = cl.getprops()
639 for prop_name in prop_names: 639 for spec in prop_names:
640 if not all_props.has_key(prop_name): 640 if ':' in spec:
641 try:
642 name, width = spec.split(':')
643 except (ValueError, TypeError):
644 raise UsageError, '"%s" not name:width'%spec
645 else:
646 name = spec
647 if not all_props.has_key(name):
641 raise UsageError, '%s has no property "%s"'%(classname, 648 raise UsageError, '%s has no property "%s"'%(classname,
642 prop_name) 649 name)
643 else: 650 else:
644 prop_names = cl.getprops().keys() 651 prop_names = cl.getprops().keys()
645 652
646 # now figure column widths 653 # now figure column widths
647 props = [] 654 props = []
649 if ':' in spec: 656 if ':' in spec:
650 try: 657 try:
651 name, width = spec.split(':') 658 name, width = spec.split(':')
652 except (ValueError, TypeError): 659 except (ValueError, TypeError):
653 raise UsageError, '"%s" not name:width'%spec 660 raise UsageError, '"%s" not name:width'%spec
654 props.append((spec, int(width))) 661 props.append((name, int(width)))
655 else: 662 else:
656 props.append((spec, len(spec))) 663 props.append((spec, len(spec)))
657 664
658 # now display the heading 665 # now display the heading
659 print ' '.join([name.capitalize() for name, width in props]) 666 print ' '.join([name.capitalize().ljust(width) for name,width in props])
660 667
661 # and the table data 668 # and the table data
662 for nodeid in cl.list(): 669 for nodeid in cl.list():
663 l = [] 670 l = []
664 for name, width in props: 671 for name, width in props:
1010 tool = AdminTool() 1017 tool = AdminTool()
1011 sys.exit(tool.main()) 1018 sys.exit(tool.main())
1012 1019
1013 # 1020 #
1014 # $Log: not supported by cvs2svn $ 1021 # $Log: not supported by cvs2svn $
1022 # Revision 1.58 2001/12/31 05:12:52 richard
1023 # actually handle the advertised <cr> response to "commit y/N?"
1024 #
1015 # Revision 1.57 2001/12/31 05:12:01 richard 1025 # Revision 1.57 2001/12/31 05:12:01 richard
1016 # added some quoting instructions to roundup-admin 1026 # added some quoting instructions to roundup-admin
1017 # 1027 #
1018 # Revision 1.56 2001/12/31 05:09:20 richard 1028 # Revision 1.56 2001/12/31 05:09:20 richard
1019 # Added better tokenising to roundup-admin - handles spaces and stuff. Can 1029 # Added better tokenising to roundup-admin - handles spaces and stuff. Can

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