Fix file open rules

This commit is contained in:
Ross Lawley 2013-01-28 16:26:01 +00:00
parent 9ca632d518
commit 39dac7d4db
2 changed files with 9 additions and 9 deletions

View File

@ -1950,7 +1950,7 @@ class FieldTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()
@ -1973,7 +1973,7 @@ class FieldTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()
@ -1996,7 +1996,7 @@ class FieldTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()
@ -2019,7 +2019,7 @@ class FieldTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()

View File

@ -208,7 +208,7 @@ class FileTest(unittest.TestCase):
Animal.drop_collection() Animal.drop_collection()
marmot = Animal(genus='Marmota', family='Sciuridae') marmot = Animal(genus='Marmota', family='Sciuridae')
marmot_photo = open(TEST_IMAGE_PATH, 'r') # Retrieve a photo from disk marmot_photo = open(TEST_IMAGE_PATH, 'rb') # Retrieve a photo from disk
marmot.photo.put(marmot_photo, content_type='image/jpeg', foo='bar') marmot.photo.put(marmot_photo, content_type='image/jpeg', foo='bar')
marmot.photo.close() marmot.photo.close()
marmot.save() marmot.save()
@ -251,7 +251,7 @@ class FileTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()
@ -274,7 +274,7 @@ class FileTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()
@ -297,7 +297,7 @@ class FileTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()
@ -320,7 +320,7 @@ class FileTest(unittest.TestCase):
TestImage.drop_collection() TestImage.drop_collection()
t = TestImage() t = TestImage()
t.image.put(open(TEST_IMAGE_PATH, 'r')) t.image.put(open(TEST_IMAGE_PATH, 'rb'))
t.save() t.save()
t = TestImage.objects.first() t = TestImage.objects.first()