Changeset 300
- Timestamp:
- 12/09/09 18:42:25
- Files:
-
- sodar/trunk/sodar/scintec/maindata.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sodar/trunk/sodar/scintec/maindata.py
r296 r300 152 152 # Divide the data into blocks 153 153 # across boundaries separated by blank lines. 154 blocks = [block.strip() 155 for block 156 in mnd.split('\n\n') 157 if block.strip()] 154 EOL = '\r\n' # Windows file binary copied to Unix 155 def divide(mnd,eol): 156 blocks = [block.strip() 157 for block 158 in mnd.split(eol*2) 159 if block.strip()] 160 if len(blocks) < 2: 161 eol = '\n' # Windows to Windows or Unix to Unix 162 blocks, eol = divide(mnd,eol) 163 return (blocks,eol) 164 blocks,EOL = divide(mnd,EOL) 158 165 159 166 # The first block is the specification of the format header. … … 161 168 format_header_spec = [line.strip() 162 169 for line 163 in blocks[0].split( '\n')170 in blocks[0].split(EOL) 164 171 if line.strip()] 165 172 … … 190 197 file_header_body = [line.strip() 191 198 for line 192 in blocks[1].split( '\n')199 in blocks[1].split(EOL) 193 200 if not line.strip().startswith('#')] 194 201 self.comments = dict([(name.strip(),value.strip()) … … 219 226 self.extend([Profile([line.strip() 220 227 for line 221 in block.split( '\n')228 in block.split(EOL) 222 229 if line.strip()]) 223 230 for block