Ticket #341: paste.patch

File paste.patch, 1.2 KB (added by chrisz, 3 years ago)

Fix for mimetype.guess_type problem

  • paste/httpheaders.py

     
    136136""" 
    137137import urllib2 
    138138import re 
    139 from mimetypes import guess_type 
     139import mimetypes 
    140140from rfc822 import formatdate, parsedate_tz, mktime_tz 
    141141from time import time as now 
    142142from httpexceptions import HTTPBadRequest 
     
    575575        (key, val) = response_headers[idx] 
    576576        head = get_header(key, strict) 
    577577        if not head: 
    578             newhead = '-'.join([x.capitalize() for x in  
     578            newhead = '-'.join([x.capitalize() for x in 
    579579                                key.replace("_","-").split("-")]) 
    580580            response_headers[idx] = (newhead, val) 
    581581            category[newhead] = 4 
     
    855855        (result, filename) = self._compose(**kwargs) 
    856856        mimetype = CONTENT_TYPE(collection) 
    857857        if filename and (not mimetype or CONTENT_TYPE.UNKNOWN == mimetype): 
    858             mimetype, _ = guess_type(filename) 
     858            mimetype, _ = mimetypes.guess_type(filename) 
    859859            if mimetype and CONTENT_TYPE.UNKNOWN != mimetype: 
    860860                CONTENT_TYPE.update(collection, mimetype) 
    861861        self.update(collection, *result)