Example #1
0
def handler500(request):
    context = {
        'request': request,
    }

    # This will make things prettier if we can manage it.
    # No worries if we can't.
    try:
        from molly.wurfl.context_processors import device_specific_media
        context.update(device_specific_media(request))
    except Exception, e:
        pass
Example #2
0
def handler500(request):
    context = {
        'request': request,
        'STATIC_URL': settings.STATIC_URL,
    }

    # This will make things prettier if we can manage it.
    # No worries if we can't.
    try:
        from molly.wurfl.context_processors import device_specific_media
        context.update(device_specific_media(request))
    except Exception, e:
        pass
Example #3
0
def handler500(request, exc_info=None):

    context = {
        'request': request,
    }

    if exc_info and (request.user.is_superuser or settings.DEBUG):
        # Now try and return this as a redirect if we're using fragment rendering
        if request.GET.get('format') == 'fragment':
            try:
                return HttpResponse(simplejson.dumps({
                    'redirect':
                    tidy_query_string(request.build_absolute_uri())
                }),
                                    mimetype="application/json")
            except:
                pass

        return technical_500_response(request, *exc_info)

    # This will make things prettier if we can manage it.
    # No worries if we can't.
    try:
        from molly.wurfl.context_processors import device_specific_media
        context.update(device_specific_media(request))
    except:
        pass

    # This will make stop mixed content warnings if we can manage it
    try:
        from molly.utils.context_processors import ssl_media
        context.update(ssl_media(request))
    except:
        context.update({'STATIC_URL': settings.STATIC_URL})

    response = render_to_response('500.html', context)
    response.status_code = 500
    return response
Example #4
0
def handler500(request, exc_info=None):
    
    context = {
        'request': request,
    }

    if exc_info and (request.user.is_superuser or settings.DEBUG):
        # Now try and return this as a redirect if we're using fragment rendering
        if request.GET.get('format') == 'fragment':
            try:
                return HttpResponse(simplejson.dumps({
                        'redirect': tidy_query_string(request.build_absolute_uri())
                    }), mimetype="application/json")
            except:
                pass
        
        return technical_500_response(request, *exc_info)

    # This will make things prettier if we can manage it.
    # No worries if we can't.
    try:
        from molly.wurfl.context_processors import device_specific_media
        context.update(device_specific_media(request))
    except:
        pass
    
    # This will make stop mixed content warnings if we can manage it
    try:
        from molly.utils.context_processors import ssl_media
        context.update(ssl_media(request))
    except:
        context.update({'STATIC_URL': settings.STATIC_URL})

    response = render_to_response('500.html', context)
    response.status_code = 500
    return response