Beispiel #1
0
def error_404(request, exception, template_name='404.html'):
    template = get_template(template_name)
    return HttpResponseNotFound(
        template.render({
            'date_now': now(r"Y-m-d\TH:m:sO"),
            'request': request,
        }))
Beispiel #2
0
def error_500(request, template_name='500.html'):
	template = get_template(template_name)
	except_type, value, _ = sys.exc_info()
	return HttpResponseServerError(template.render({
		'date_now': now(r"Y-m-d\TH:m:sO"),
		'exception_type': except_type.__name__,
		'exception_value': value,
		'request': request
	}))
Beispiel #3
0
def error_500(request, template_name='500.html'):
    template = get_template(template_name)
    except_type, value, _ = sys.exc_info()
    return HttpResponseServerError(
        template.render({
            'date_now': now(r"Y-m-d\TH:m:sO"),
            'exception_type': except_type.__name__,
            'exception_value': value,
            'request': request
        }))
Beispiel #4
0
def error_404(request, exception, template_name='404.html'):
    template = get_template(template_name)
    ctx = {
        'date_now': now(r"Y-m-d\TH:m:sO"),
        'request': request,
    }
    print(type(exception))
    if isinstance(exception,
                  Http404) and not isinstance(exception, Resolver404):
        ctx['detail'] = exception
    return HttpResponseNotFound(template.render(ctx))
Beispiel #5
0
def error_500(request):
    template = get_template("500.html")
    except_type, value, _ = sys.exc_info()
    return HttpResponseServerError(
        template.render(
            {
                "date_now": now(r"Y-m-d\TH:m:sO"),
                "exception_type": except_type.__name__,
                "exception_value": value,
                "request": request,
            }
        )
    )
Beispiel #6
0
def error_404(request, exception, template_name='404.html'):
	template = get_template(template_name)
	return HttpResponseNotFound(template.render({
		'date_now': now(r"Y-m-d\TH:m:sO"),
		'request': request,
	}))
Beispiel #7
0
def error_404(request):
	template = get_template('404.html')
	return HttpResponseServerError(template.render({
		'date_now': now(r"Y-m-d\TH:m:sO"),
		'request': request,
	}))
Beispiel #8
0
def error_404(request):
    template = get_template("404.html")
    return HttpResponseNotFound(template.render({"date_now": now(r"Y-m-d\TH:m:sO"), "request": request}))