# -*- coding: utf-8 -*-

from django.template import RequestContext, loader
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden  

# A custom Http403 exception
# from http://theglenbot.com/creating-a-custom-http403-exception-in-django/

class Http403(Exception):    
    pass  

def render_to_403(*args, **kwargs):     
    if not isinstance(args,list):         
        args = []         
        args.append('403.html')              

    httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}          
    response = HttpResponseForbidden(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)              

    return response  

class Http403Middleware(object):     
    def process_exception(self,request,exception):         
        if isinstance(exception,Http403):             
            if getattr(settings, 'DEBUG'):                 
                raise PermissionDenied             
            return render_to_403(context_instance=RequestContext(request))      

@@ -537,20 +537,24 @@
 rgs = %7B'
-mime
+content_
 type': k
@@ -568,12 +568,16 @@
 op('
-mime
+content_
 type

Update mimetype to content_type here, too.