Changeset 665 for trunk/jobmond
- Timestamp:
- 09/04/12 15:02:29 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobmond/jobmond.py
r664 r665 113 113 return clean_value 114 114 115 def removeComments( self, value ): 116 117 clean_value = value 118 119 if clean_value.find('#') != -1: 120 121 clean_value = value[:value.find('#')] 122 123 if clean_value.find('//') != -1: 124 125 clean_value = value[:value.find('//')] 126 127 return clean_value 128 115 129 def getVal( self, section, valname ): 116 130 117 131 cfg_fp = open( self.config_file ) 118 section_start = False 119 section_found = False 120 value = None 121 122 for line in cfg_fp.readlines(): 132 cfg_lines = cfg_fp.readlines() 133 cfg_fp.close() 134 135 section_start = False 136 section_found = False 137 value = None 138 comment_start = False 139 140 for line in cfg_lines: 141 142 line = line.strip() 143 line = self.removeComments( line ) 144 145 if line.find( '/*' ) != -1: 146 147 line = line[:line.find('/*')] 148 comment_start = True 149 150 if line.find( '*/' ) != -1: 151 152 line = line[line.find('*/'):] 153 comment_start = False 154 155 if comment_start: 156 157 continue 123 158 124 159 if line.find( section ) != -1: … … 138 173 139 174 value = string.join( line.split( '=' )[1:], '' ).strip() 140 141 cfg_fp.close()142 175 143 176 return value
Note: See TracChangeset
for help on using the changeset viewer.