mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Change rfc822_escape() to ensure there's a consistent amount of whitespace
after each newline, instead of just blindly inserting a space at the start of each line. (Improvement suggested by Thomas Wouters)
This commit is contained in:
		
							parent
							
								
									aa90adcfb9
								
							
						
					
					
						commit
						88b0884787
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		|  | @ -446,10 +446,11 @@ def byte_compile (py_files, | |||
| 
 | ||||
| def rfc822_escape (header): | ||||
|     """Return a version of the string escaped for inclusion in an | ||||
|     RFC-822 header, by adding a space after each newline. | ||||
|     RFC-822 header, by ensuring there are 8 spaces space after each newline. | ||||
|     """ | ||||
|     header = string.rstrip(header) | ||||
|     header = string.replace(header, '\n', '\n ') | ||||
|     lines = string.split(header, '\n') | ||||
|     lines = map(string.strip, lines) | ||||
|     header = string.join(lines, '\n' + 8*' ') | ||||
|     return header | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andrew M. Kuchling
						Andrew M. Kuchling