Esempio n. 1
0
def page_not_found(request, template_name='404.html'):
    """
    Default 404 handler.

    Templates: :template:`404.html`
    Context:
        request_path
            The path of the requested URL (e.g., '/app/pages/bad_page/')
    """
    return django_page_not_found(request, template_name=template_name)
Esempio n. 2
0
def page_not_found(request):
    try:
        try:
            from cms.models import Page
            root = Page.objects.root()
            page = root[0]
        except IndexError:
            page = root
        return HttpResponseNotFound( \
            render_to_string("404.html", {"page": page,}, RequestContext(request)))
    except: # DB table may not exist, but no import error
        return django_page_not_found(request)
Esempio n. 3
0
def page_not_found(request):
    try:
        try:
            from cms.models import Page
            root = Page.objects.root()
            page = root[0]
        except IndexError:
            page = root
        return HttpResponseNotFound( \
            render_to_string("404.html", {"page": page,}, RequestContext(request)))
    except:  # DB table may not exist, but no import error
        return django_page_not_found(request)
Esempio n. 4
0
def page_not_found(request):
    logging.warn('[404] %s %s', request.get_full_path(), request.META)
    if request.path.startswith('/api/'):
        return http.HttpResponseNotFound('{}', content_type='application/json')
    return django_page_not_found(request)
Esempio n. 5
0
def page_not_found(request, exception=None, template_name='dpaste/404.html'):
    return django_page_not_found(request,
                                 exception,
                                 template_name=template_name)
Esempio n. 6
0
def page_not_found(request, template_name='dpaste/404.html'):
    return django_page_not_found(request, template_name)
Esempio n. 7
0
def page_not_found(request, exception=None, template_name='dpaste/404.html'):
    return django_page_not_found(
        request, exception, template_name=template_name
    )
Esempio n. 8
0
def page_not_found(request, template_name='dpaste/404.html'):
    return django_page_not_found(request, template_name)  # pragma: no cover
Esempio n. 9
0
def page_not_found(request, template_name='404.html'):
    logging.info('Django 404 error: %s', request.path)
    return django_page_not_found(request, template_name)
Esempio n. 10
0
def page_not_found(request, template_name='paste/404.html'):
    return django_page_not_found(request, template_name) # pragma: no cover