/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/config.py

  • Committer: Tim Marston
  • Date: 2016-02-13 13:20:44 UTC
  • Revision ID: tim@ed.am-20160213132044-t5zaxhdlhjyn4t1v
moved handling of --verbose to main program; manuall parse config file (because
ConfigFileParse does not support allow_no_value in python 2.6)

Show diffs side-by-side

added added

removed removed

43
43
                                lines = f.readlines()
44
44
                except IOError as e:
45
45
                        if e.errno != errno.ENOENT: raise
46
 
                        lines = list()
47
46
 
48
47
                # parse config
49
48
                config = dict();
74
73
                                        if( matches ):
75
74
                                                value = matches.group( 1 )
76
75
                                config[ "%s.%s" % ( section, name ) ] = value
77
 
                                #print "  %s.%s = %s" % ( section, name, value )
 
76
                                print "  %s.%s = %s" % ( section, name, value )
78
77
 
79
78
                # use config
80
79
                if 'stdhome.home-dir' in config:
87
86
 
88
87
        def to_bool( self, value ):
89
88
                value = value.lower()
90
 
                return value == 't' or value == 'true' or value == 'yes' or \
91
 
                        ( re.match( '[0-9]+$', value ) and int( value ) != 0 )
 
89
                return value == 't' || value == 'true' || value == 'yes' || \
 
90
                        ( re.match( '[0-9]+$', value ) && int( value ) != 0 )