<s> from django . http import HttpResponseForbidden <EOL> from django . template import Context , Template <EOL> from django . conf import settings <EOL> CSRF_FAILURE_TEMPLATE = """<STR_LIT>""" <EOL> def csrf_failure ( request , reason = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> from django . middleware . csrf import REASON_NO_REFERER <EOL> t = Template ( CSRF_FAILURE_TEMPLATE ) <EOL> c = Context ( { '<STR_LIT>' : settings . DEBUG , <EOL> '<STR_LIT>' : reason , <EOL> '<STR_LIT>' : reason == REASON_NO_REFERER <EOL> } ) <EOL> return HttpResponseForbidden ( t . render ( c ) , mimetype = '<STR_LIT>' ) </s>
