示例#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)
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)
示例#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)
示例#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)
示例#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)
示例#6
0
文件: views.py 项目: zzzirk/dpaste
def page_not_found(request, template_name='dpaste/404.html'):
    return django_page_not_found(request, template_name)
示例#7
0
文件: views.py 项目: bartTC/dpaste
def page_not_found(request, exception=None, template_name='dpaste/404.html'):
    return django_page_not_found(
        request, exception, template_name=template_name
    )
示例#8
0
def page_not_found(request, template_name='dpaste/404.html'):
    return django_page_not_found(request, template_name)  # pragma: no cover
示例#9
0
文件: views.py 项目: prem1982/Vibha
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)
示例#10
0
文件: views.py 项目: rain0r/dpaste
def page_not_found(request, template_name='paste/404.html'):
    return django_page_not_found(request, template_name) # pragma: no cover