Merge branch 'master' of ssh.github.com:cortesi/pathod

This commit is contained in:
Aldo Cortesi 2013-06-16 11:00:22 +12:00
commit 868d8278e6
2 changed files with 4 additions and 4 deletions

View File

@ -181,7 +181,7 @@ class RandomGenerator:
class FileGenerator:
def __init__(self, path):
self.path = path
self.fp = file(path, "r")
self.fp = file(path, "rb")
self.map = mmap.mmap(self.fp.fileno(), 0, prot=mmap.PROT_READ)
def __len__(self):
@ -957,7 +957,7 @@ def read_file(settings, s):
raise FileAccessDenied("File access outside of configured directory")
if not os.path.isfile(s):
raise FileAccessDenied("File not readable")
return file(s, "r").read()
return file(s, "rb").read()
def parse_response(settings, s):

View File

@ -95,7 +95,7 @@ class TestValueFile:
v = language.Value.parseString("<path")[0]
with tutils.tmpdir() as t:
p = os.path.join(t, "path")
f = open(p, "w")
f = open(p, "wb")
f.write("x"*10000)
f.close()
@ -143,7 +143,7 @@ class TestMisc:
def test_filegenerator(self):
with tutils.tmpdir() as t:
path = os.path.join(t, "foo")
f = open(path, "w")
f = open(path, "wb")
f.write("x"*10000)
f.close()
g = language.FileGenerator(path)