55
54
if line[ :1 ] == '#': continue
58
matches = re.search( '^\[(.*)\]$', line );
57
matches = re.match( '\[(.*)\]$', line );
60
59
section = matches.group( 1 )
62
matches = re.search( '^([a-z0-9_-]+)\\s*=\\s*(.*)$', line, re.I )
61
matches = re.match( '([a-z0-9_-]+)\\s*=\\s*(.*)$', line, re.I )
64
63
name = matches.group( 1 )
65
64
value = matches.group( 2 )
69
'^(["\'])((?:\\.|[^\\1])*)\\1(?:\\s*#.*)?$', value )
67
matches = re.match( '(["\'])((?:\\.|[^\\1])*)\\1(?:\\s*#.*)?$',
71
70
value = matches.group( 2 )
73
matches = re.search( '^([^#]+?)(?:\\s*#.*)?$', value )
72
matches = re.match( '([^#]+?)(?:\\s*#.*)?$', value )
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 )
80
79
if 'stdhome.home-dir' in config:
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.search( '^[0-9]+$', value ) and int( value ) != 0 )
89
return value == 't' || value == 'true' || value == 'yes' || \
90
( re.match( '[0-9]+$', value ) && int( value ) != 0 )