diff upreckon/files.py @ 174:e0b2fbd7ebe0

Improved built-in output validator; added conf. var. binary The built-in output validator now reads blocks rather than lines, which should make it faster. There is also a new configuration variable called binary, which defaults to False and specifies whether the built-in output validator should not try to translate line breaks. Finally, when binary is false, the built-in output validator now translates line breaks even if it the reference output is in a tape archive.
author Oleg Oshmyan <chortos@inbox.lv>
date Sat, 18 Jun 2011 02:55:17 +0100
parents f8041e1e4d0d
children 0d657576b1ac
line wrap: on
line diff
--- a/upreckon/files.py	Thu Jun 16 01:24:10 2011 +0100
+++ b/upreckon/files.py	Sat Jun 18 02:55:17 2011 +0100
@@ -60,7 +60,6 @@
 			member.name = target
 			self.file.extract(member)
 		
-		# TODO: somehow automagically emulate universal line break support
 		def open(self, name):
 			return self.file.extractfile(name)
 		
@@ -117,7 +116,7 @@
 				self.file.extract(member)
 		
 		def open(self, name):
-			return self.file.open(name, 'rU')
+			return self.file.open(name, 'r')
 		
 		def exists(self, queried_name):
 			if not hasattr(self, '_namelist'):
@@ -232,7 +231,7 @@
 			else:
 				return contextlib.closing(file)
 		else:
-			return open(self.real_path, 'rU')
+			return open(self.real_path, 'rb')
 	
 	def copy(self, target):
 		if self.archive: