Site Sections: Satchmo Main | Wiki | Demo Store |

Show
Ignore:
Timestamp:
08/31/08 22:53:01 (3 months ago)
Author:
chris
Message:

Improve downloadable product support by trying to guess accurate content-type. Closes #479

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • satchmo/trunk/satchmo/shop/views/download.py

    r1424 r1475  
    55from django.utils.translation import ugettext_lazy as _ 
    66from satchmo.shop.models import DownloadLink 
     7import mimetypes 
    78 
    89import os 
     
    8788    response['Content-Disposition'] = "attachment; filename=%s" % file_name 
    8889    response['Content-length'] =  os.stat(dl_product.downloadable_product.file.path).st_size 
     90    contenttype, encoding = mimetypes.guess_type(file_name) 
     91    if contenttype: 
     92        response['Content-type'] = contenttype 
    8993    return response