Changeset 269 for trunk/src


Ignore:
Timestamp:
01/19/11 14:13:08 (13 years ago)
Author:
dennis
Message:

Fixed AdvancedParser? when using range 01-12

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/AdvancedParser.py

    r261 r269  
    77#
    88# SVN Info:
    9 #       $Id: AdvancedParser.py 3667 2009-04-15 12:02:04Z dennis $
    10 #       $URL: https://subtrac.sara.nl/hpcv/svn/beowulf/trunk/sara_python_modules/AdvancedParser.py $
     9#       $Id: AdvancedParser.py 5338 2011-01-19 13:09:09Z dennis $
     10#       $URL: https://subtrac.sara.nl/osd/beowulf/svn/trunk/python_modules/advancedparser/AdvancedParser.py $
    1111#
    1212from optparse import OptionParser
     
    1515
    1616__author__  = "Dennis Stam"
    17 __version__ = ( 1, 1, 0 )
     17__version__ = ( 1, 1, 2 )
    1818
    1919class AdvancedParser(OptionParser):
     
    8585                        try:
    8686                            if chars[ 0 ][ 0 ] == '0' or chars[ 1 ][ 0 ]:
    87                                 if len( chars[ 0 ] ) > len( chars[ 1 ] ):
     87                                if len( chars[ 0 ] ) >= len( chars[ 1 ] ):
    8888                                    equal_width_length = len( chars[ 0 ] )
    8989                                else:
     
    9898                            equal_width_lenght = len( section )
    9999                        numbers_chars.append( section )
     100
     101                    tmp_list = list()
     102                    if equal_width_length > 0:
     103                        for number_char in numbers_chars:
     104                            try:
     105                                nnum = int( number_char )
     106                                tmp_list.append( '%0*d' % ( equal_width_length, nnum ) )
     107                            except ValueError:
     108                                tmp_list.append( number_char )
     109                        numbers_chars = tmp_list
    100110
    101111                return numbers_chars
Note: See TracChangeset for help on using the changeset viewer.