Changeset 7298


Ignore:
Timestamp:
Jul 3, 2009, 3:30:39 PM (15 years ago)
Author:
rwilson
Message:

Made program insert only 'Yes' or 'No' into 'publishable' field.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • misc/tools/update_lic_checksum/create_lic_file.py

    r7276 r7298  
    2828    <filename></filename>
    2929    <checksum>-1</checksum>
    30     <publishable>Y</publishable>
     30    <publishable>Yes</publishable>
    3131    <accountable>ANUGA developer</accountable>
    3232    <source>Generated by ANUGA development team</source>
     
    3636
    3737'''
     38
     39# dictionary to map yes/no chars to a string
     40YesNoDict = {'y': 'Yes',
     41             'n': 'No'}
    3842
    3943
     
    162166            arg_author = opt_arg
    163167        elif opt in ['-p', '--publishable']:
    164             arg_publishable = opt_arg.title()
     168            try:
     169                arg_publishable = YesNoDict[opt_arg.lower()[0]]
     170            except KeyError:
     171                print("Bad %s arg: '%s' "
     172                      "(expected a string starting 'y', 'n', 'Y' or 'N')"
     173                      % (opt, opt_arg))
    165174        elif opt in ['-a', '--accountable']:
    166175            arg_accountable = opt_arg
Note: See TracChangeset for help on using the changeset viewer.