#NEWLINE# def _parse_lines( self , fi , mode = 'srv' ) : #NEWLINE# #INDENT# dic = [ ] #NEWLINE# boolean = [ ] #NEWLINE# multi = [ ] #NEWLINE# integer = [ ] #NEWLINE# includes = [ ] #NEWLINE# includes_ext = [ ] #NEWLINE# for l in fi : #NEWLINE# #INDENT# if re . match ( '^\\s*#' , l ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# r = re . search ( '\\s*([^=\\s]+)\\s*=?\\s*(.*)$' , l ) #NEWLINE# if r : #NEWLINE# #INDENT# key = r . group ( 1 ) #NEWLINE# val = r . group ( 2 ) #NEWLINE# if ( ( mode == 'srv' ) and ( key == 'directory' ) ) : #NEWLINE# #INDENT# self . workingdir = val #NEWLINE# #UNINDENT# if ( key in getattr ( self , 'boolean_{}' . format ( mode ) ) ) : #NEWLINE# #INDENT# boolean . append ( { #NEWLINE# #INDENT# 'name' : key , #NEWLINE# 'value' : ( int ( val ) == 1 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key in getattr ( self , 'integer_{}' . format ( mode ) ) ) : #NEWLINE# #INDENT# integer . append ( { #NEWLINE# #INDENT# 'name' : key , #NEWLINE# 'value' : int ( val ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# if ( key == '.' ) : #NEWLINE# #INDENT# i = val #NEWLINE# if ( not val . startswith ( '/' ) ) : #NEWLINE# #INDENT# if ( mode == 'srv' ) : #NEWLINE# #INDENT# i = os . path . join ( self . root , val ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# i = os . path . join ( self . clientconfdir , val ) #NEWLINE# #UNINDENT# #UNINDENT# for p in glob ( i ) : #NEWLINE# #INDENT# includes_ext . append ( { #NEWLINE# #INDENT# 'name' : p , #NEWLINE# 'value' : val , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# includes . append ( val ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ( key in getattr ( self , 'multi_{}' . format ( mode ) ) ) : #NEWLINE# #INDENT# found = False #NEWLINE# for m in multi : #NEWLINE# #INDENT# if ( m [ 'name' ] == key ) : #NEWLINE# #INDENT# m [ 'value' ] . append ( val ) #NEWLINE# found = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not found ) : #NEWLINE# #INDENT# multi . append ( { #NEWLINE# #INDENT# 'name' : key , #NEWLINE# 'value' : [ val ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# continue #NEWLINE# #UNINDENT# if ( key == 'clientconfdir' ) : #NEWLINE# #INDENT# if ( mode != 'srv' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( not val . startswith ( '/' ) ) : #NEWLINE# #INDENT# self . clientconfdir = os . path . join ( self . root , val ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . clientconfdir = val #NEWLINE# #UNINDENT# #UNINDENT# dic . append ( { #NEWLINE# #INDENT# 'name' : key , #NEWLINE# 'value' : val , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return ( dic , boolean , multi , integer , includes , includes_ext )