Django

Code

Ticket #7696: 7696-r7871.diff

File 7696-r7871.diff, 0.6 kB (added by Gulopine, 5 months ago)

Adds an explicit , 'rb' to open() to fix this on Windows

  • tests/modeltests/model_forms/models.py

    old new  
    900900...     class Meta: 
    901901...         model = ImageFile 
    902902 
    903 >>> image_data = open(os.path.join(os.path.dirname(__file__), "test.png")).read() 
     903>>> image_data = open(os.path.join(os.path.dirname(__file__), "test.png"), 'rb').read() 
    904904 
    905905>>> f = ImageFileForm(data={'description': u'An image'}, files={'image': SimpleUploadedFile('test.png', image_data)}) 
    906906>>> f.is_valid()