1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

magic-removal: Changed 404 and 500 templates to add .html extension. Refs #1643

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-04-15 20:14:51 +00:00
parent fe0d508a6a
commit 231a6edb7d

View File

@ -26,7 +26,7 @@ def shortcut(request, content_type_id, object_id):
object_domain = None object_domain = None
# Otherwise, we need to introspect the object's relationships for a # Otherwise, we need to introspect the object's relationships for a
# relation to the Site object # relation to the Site object
opts = obj._meta opts = obj._meta
@ -57,30 +57,30 @@ def shortcut(request, content_type_id, object_id):
object_domain = Site.objects.get_current().domain object_domain = Site.objects.get_current().domain
except Site.DoesNotExist: except Site.DoesNotExist:
pass pass
# If all that malarky found an object domain, use it; otherwise fall back # If all that malarky found an object domain, use it; otherwise fall back
# to whatever get_absolute_url() returned. # to whatever get_absolute_url() returned.
if object_domain is not None: if object_domain is not None:
return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl)) return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
else: else:
return http.HttpResponseRedirect(absurl) return http.HttpResponseRedirect(absurl)
def page_not_found(request, template_name='404'): def page_not_found(request, template_name='404.html'):
""" """
Default 404 handler, which looks for the requested URL in the redirects Default 404 handler, which looks for the requested URL in the redirects
table, redirects if found, and displays 404 page if not redirected. table, redirects if found, and displays 404 page if not redirected.
Templates: `404` Templates: `404.html`
Context: None Context: None
""" """
t = loader.get_template(template_name) t = loader.get_template(template_name)
return http.HttpResponseNotFound(t.render(Context())) return http.HttpResponseNotFound(t.render(Context()))
def server_error(request, template_name='500'): def server_error(request, template_name='500.html'):
""" """
500 error handler. 500 error handler.
Templates: `500` Templates: `500.html`
Context: None Context: None
""" """
t = loader.get_template(template_name) t = loader.get_template(template_name)