Changeset 245:d52a1bbfbf30


Ignore:
Timestamp:
18.02.2010 13:04:35 (2 years ago)
Author:
slav0nic <slav0nic0@…>
Branch:
default
Message:

fixed attachments upload on Windows

Location:
djangobb/djangobb_forum
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • djangobb/djangobb_forum/forms.py

    r231 r245  
    107107            fname = '%d.0' % post.id 
    108108            path = os.path.join(dir, fname) 
    109             file(path, 'w').write(memfile.read()) 
     109            file(path, 'wb').write(memfile.read()) 
    110110            obj.path = fname 
    111111            obj.save() 
  • djangobb/djangobb_forum/views.py

    r243 r245  
    784784def show_attachment(request, hash): 
    785785    attachment = get_object_or_404(Attachment, hash=hash) 
    786     file_data = file(attachment.get_absolute_path()).read() 
     786    file_data = file(attachment.get_absolute_path(), 'rb').read() 
    787787    response = HttpResponse(file_data, mimetype=attachment.content_type) 
    788788    response['Content-Disposition'] = 'attachment; filename=%s' % smart_str(attachment.name) 
Note: See TracChangeset for help on using the changeset viewer.